Base class for all TrueType fonts.
Inheritance: ICloneable
Example #1
0
        protected virtual TrueTypeFontTable DeepCopy()
        {
            TrueTypeFontTable fontTable = (TrueTypeFontTable)MemberwiseClone();

            fontTable.DirectoryEntry.Offset    = 0;
            fontTable.DirectoryEntry.FontTable = fontTable;
            return(fontTable);
        }
 public GenericFontTable(TrueTypeFontTable fontTable)
   : base(null, "xxxx")
 {
   DirectoryEntry.Tag = fontTable.DirectoryEntry.Tag;
   int length = fontTable.DirectoryEntry.Length;
   if (length > 0)
   {
     this.table = new byte[length];
     Buffer.BlockCopy(fontTable.FontImage.Bytes, fontTable.DirectoryEntry.Offset, this.table, 0, length);
   }
 }
Example #3
0
        public GenericFontTable(TrueTypeFontTable fontTable)
            : base(null, "xxxx")
        {
            DirectoryEntry.Tag = fontTable.DirectoryEntry.Tag;
            int length = fontTable.DirectoryEntry.Length;

            if (length > 0)
            {
                this.table = new byte[length];
                Buffer.BlockCopy(fontTable.FontData.Data, fontTable.DirectoryEntry.Offset, this.table, 0, length);
            }
        }
Example #4
0
 public IRefFontTable(FontData fontData, TrueTypeFontTable fontTable)
     : base(null, fontTable.DirectoryEntry.Tag)
 {
     this.fontData           = fontData;
     this.irefDirectoryEntry = fontTable.DirectoryEntry;
 }
Example #5
0
    /// <summary>
    /// Adds the specified table to this font image.
    /// </summary>
    public void AddTable(TrueTypeFontTable fontTable)
    {
      if (!CanWrite)
        throw new InvalidOperationException("Font image cannot be modified.");

      if (fontTable == null)
        throw new ArgumentNullException("fontTable");

      if (fontTable.FontImage == null)
      {
        fontTable.fontImage = this;
      }
      else
      {
        Debug.Assert(fontTable.FontImage.CanRead);
        // Create a reference to this font table
        fontTable = new IRefFontTable(this, fontTable);
      }

      //Debug.Assert(fontTable.FontImage == null);
      //fontTable.fontImage = this;

      this.tableDictionary[fontTable.DirectoryEntry.Tag] = fontTable.DirectoryEntry;
      switch (fontTable.DirectoryEntry.Tag)
      {
        case TableTagNames.CMap:
          this.cmap = fontTable as CMapTable;
          break;

        case TableTagNames.Cvt:
          this.cvt = fontTable as ControlValueTable;
          break;

        case TableTagNames.Fpgm:
          this.fpgm = fontTable as FontProgram;
          break;

        case TableTagNames.MaxP:
          this.maxp = fontTable as MaximumProfileTable;
          break;

        case TableTagNames.Name:
          this.name = fontTable as NameTable;
          break;

        case TableTagNames.Head:
          this.head = fontTable as FontHeaderTable;
          break;

        case TableTagNames.HHea:
          this.hhea = fontTable as HorizontalHeaderTable;
          break;

        case TableTagNames.HMtx:
          this.hmtx = fontTable as HorizontalMetricsTable;
          break;

        case TableTagNames.OS2:
          this.os2 = fontTable as OS2Table;
          break;

        case TableTagNames.Post:
          this.post = fontTable as PostScriptTable;
          break;

        case TableTagNames.Glyf:
          this.glyf = fontTable as GlyphDataTable;
          break;

        case TableTagNames.Loca:
          this.loca = fontTable as IndexToLocationTable;
          break;

        case TableTagNames.GSUB:
          this.gsub = fontTable as GlyphSubstitutionTable;
          break;

        case TableTagNames.Prep:
          this.prep = fontTable as ControlValueProgram;
          break;
      }
    }
Example #6
0
        /// <summary>
        /// Adds the specified table to this font image.
        /// </summary>
        public void AddTable(TrueTypeFontTable fontTable)
        {
            if (!CanWrite)
            {
                throw new InvalidOperationException("Font image cannot be modified.");
            }

            if (fontTable == null)
            {
                throw new ArgumentNullException("fontTable");
            }

            if (fontTable.fontData == null)
            {
                fontTable.fontData = this;
            }
            else
            {
                Debug.Assert(fontTable.fontData.CanRead);
                // Create a reference to this font table
                fontTable = new IRefFontTable(this, fontTable);
            }

            //Debug.Assert(fontTable.FontData == null);
            //fontTable.fontData = this;

            this.tableDictionary[fontTable.DirectoryEntry.Tag] = fontTable.DirectoryEntry;
            switch (fontTable.DirectoryEntry.Tag)
            {
            case TableTagNames.CMap:
                this.cmap = fontTable as CMapTable;
                break;

            case TableTagNames.Cvt:
                this.cvt = fontTable as ControlValueTable;
                break;

            case TableTagNames.Fpgm:
                this.fpgm = fontTable as FontProgram;
                break;

            case TableTagNames.MaxP:
                this.maxp = fontTable as MaximumProfileTable;
                break;

            case TableTagNames.Name:
                this.name = fontTable as NameTable;
                break;

            case TableTagNames.Head:
                this.head = fontTable as FontHeaderTable;
                break;

            case TableTagNames.HHea:
                this.hhea = fontTable as HorizontalHeaderTable;
                break;

            case TableTagNames.HMtx:
                this.hmtx = fontTable as HorizontalMetricsTable;
                break;

            case TableTagNames.OS2:
                this.os2 = fontTable as OS2Table;
                break;

            case TableTagNames.Post:
                this.post = fontTable as PostScriptTable;
                break;

            case TableTagNames.Glyf:
                this.glyf = fontTable as GlyphDataTable;
                break;

            case TableTagNames.Loca:
                this.loca = fontTable as IndexToLocationTable;
                break;

            case TableTagNames.GSUB:
                this.gsub = fontTable as GlyphSubstitutionTable;
                break;

            case TableTagNames.Prep:
                this.prep = fontTable as ControlValueProgram;
                break;
            }
        }
 public IRefFontTable(FontImage fontImage, TrueTypeFontTable fontTable)
   : base(null, fontTable.DirectoryEntry.Tag)
 {
   this.fontImage = fontImage;
   this.irefDirectoryEntry = fontTable.DirectoryEntry;
 }
Example #8
0
 public IRefFontTable(FontData fontData, TrueTypeFontTable fontTable)
   : base(null, fontTable.DirectoryEntry.Tag)
 {
   this.fontData = fontData;
   this.irefDirectoryEntry = fontTable.DirectoryEntry;
 }