Example #1
0
        protected virtual OpenTypeFontTable DeepCopy()
        {
            OpenTypeFontTable fontTable = (OpenTypeFontTable)MemberwiseClone();

            fontTable.DirectoryEntry.Offset    = 0;
            fontTable.DirectoryEntry.FontTable = fontTable;
            return(fontTable);
        }
Example #2
0
 public IRefFontTable(OpenTypeFontface fontData, OpenTypeFontTable fontTable)
     : base(null, fontTable.DirectoryEntry.Tag)
 {
     _fontData           = fontData;
     _irefDirectoryEntry = fontTable.DirectoryEntry;
 }
Example #3
0
        /// <summary>
        /// Adds the specified table to this font image.
        /// </summary>
        public void AddTable(OpenTypeFontTable 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;

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

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

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

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

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

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

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

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

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

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

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

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

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

            case TableTagNames.Prep:
                prep = fontTable as ControlValueProgram;
                break;
            }
        }