Represents an indirect reference to an existing font table in a font image. Used to create binary copies of an existing font table that is not modified.
Inheritance: TrueTypeFontTable
Esempio n. 1
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;
      }
    }
Esempio n. 2
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;
            }
        }