示例#1
0
        public static FpgmTable Read(BinaryReaderFont reader, TableRecord record)
        {
            FpgmTable value = new FpgmTable();

            value.position = reader.Position;
            value.filePath = reader.FilePath;
            value.length   = (int)record.length;
            //value.data = reader.ReadBytes((int)record.length);
            return(value);
        }
示例#2
0
        /*
         * protected void CreateCharacterToGlyphTable() {
         *      CmapTable cmap = Tables.cmap;
         *      if (cmap == null || cmap.subtables == null) {
         *              return;
         *      }
         *      charToGlyphTable = cmap.CreateCharToGlyphTable();
         * }
         */

        protected void InterpretFpgm()
        {
            FpgmTable fpgm = Tables.fpgm;

            if (fpgm == null)
            {
                return;
            }
            byte[] data = fpgm.ReadData();
            if (data == null)
            {
                return;
            }
                        #if DEBUG
            //Console.WriteLine("Fpgm Decode:\n{0}", Interpreter.Decode(data));
                        #endif
            interpreter.Interpret(data, null);
        }
示例#3
0
        public void ReadTables(BinaryReaderFont reader)
        {
            if (offset == null)
            {
                return;
            }
            int length = offset.numTables;

            for (int i = 0; i < length; i++)
            {
                TableRecord record = Records[i];
                //Console.WriteLine(record);
                //bool checkSum = reader.TableChecksum(record);
                //Console.WriteLine("checkSum {0}: {1}", record.tableTag, checkSum);
                reader.Position = record.offset;
                long memory = 0;
                                #if DEBUG
                memory = GC.GetTotalMemory(false);
                                #endif

                switch (record.tableTag)
                {
                case AvarTable.Tag:                         // OpenType Font Variations
                    avar = AvarTable.Read(reader);
                    break;

                case BASETable.Tag:                         // Advanced Typographic Table
                    //BASE = BASETable.Read(reader);
                    break;

                case CBDTTable.Tag:                         // Related to Bitmap Glyphs, Related to Color Fonts
                    CBDT = CBDTTable.Read(reader, CBLC);
                    break;

                case CBLCTable.Tag:                         // Related to Bitmap Glyphs, Related to Color Fonts
                    CBLC = CBLCTable.Read(reader);
                    break;

                case CFFTable.Tag:                          // Related to CFF Outlines
                    CFF = CFFTable.Read(reader);
                    break;

                case CFF2Table.Tag:                         // Related to CFF Outlines
                    //CFF2 = CFF2Table.Read(reader);
                    break;

                case CmapTable.Tag:                         // Required Table
                    cmap = CmapTable.Read(reader);
                    break;

                case COLRTable.Tag:                         // Related to Color Fonts
                    //COLR = COLRTable.Read(reader);
                    break;

                case CPALTable.Tag:                         // Related to Color Fonts
                    //CPAL = CPALTable.Read(reader);
                    break;

                case CvarTable.Tag:                         // OpenType Font Variations
                    cvar = CvarTable.Read(reader);
                    break;

                case CvtTable.Tag:                          // Related to TrueType Outlines
                    cvt = CvtTable.Read(reader, record);
                    break;

                case DSIGTable.Tag:                         // Other OpenType Table
                    //DSIG = DSIGTable.Read(reader);
                    break;

                case EBDTTable.Tag:                         // Related to Bitmap Glyphs
                    EBDT = EBDTTable.Read(reader, EBLC);
                    break;

                case EBLCTable.Tag:                         // Related to Bitmap Glyphs
                    EBLC = EBLCTable.Read(reader);
                    break;

                case EBSCTable.Tag:                         // Related to Bitmap Glyphs
                    //EBSC = EBSCTable.Read(reader);
                    break;

                case FpgmTable.Tag:                         // Related to TrueType Outlines
                    fpgm = FpgmTable.Read(reader, record);
                    break;

                case FvarTable.Tag:                         // OpenType Font Variations
                    fvar = FvarTable.Read(reader);
                    break;

                case GaspTable.Tag:                         // Related to TrueType Outlines
                    //gasp = GaspTable.Read(reader);
                    break;

                case GDEFTable.Tag:                         // Advanced Typographic Table
                    //GDEF = GDEFTable.Read(reader);
                    break;

                case GlyfTable.Tag:                         // Related to TrueType Outlines
                    glyf = GlyfTable.Read(reader, loca);
                    break;

                case GPOSTable.Tag:                         // Advanced Typographic Table
                    //GPOS = GPOSTable.Read(reader);
                    break;

                case GSUBTable.Tag:                         // Advanced Typographic Table
                    //GSUB = GSUBTable.Read(reader);
                    break;

                case GvarTable.Tag:                         // OpenType Font Variations
                    //gvar = GvarTable.Read(reader);
                    break;

                case HdmxTable.Tag:                         // Other OpenType Table
                    hdmx = HdmxTable.Read(reader);
                    break;

                case HeadTable.Tag:                         // Required Table
                    head = HeadTable.Read(reader);
                    break;

                case HheaTable.Tag:                         // Required Table
                    hhea = HheaTable.Read(reader);
                    break;

                case HmtxTable.Tag:                         // Required Table
                    hmtx = HmtxTable.Read(reader, hhea, maxp);
                    break;

                case HVARTable.Tag:                         // OpenType Font Variations
                    //HVAR = HVARTable.Read(reader);
                    break;

                case JSTFTable.Tag:                         // Advanced Typographic Table
                    //JSTF = JSTFTable.Read(reader);
                    break;

                case KernTable.Tag:                         // Other OpenType Table
                    //kern = KernTable.Read(reader);
                    break;

                case LocaTable.Tag:                         // Related to TrueType Outlines
                    loca = LocaTable.Read(reader, head, maxp);
                    break;

                case LTSHTable.Tag:                         // Other OpenType Table
                    //LTSH = LTSHTable.Read(reader);
                    break;

                case MATHTable.Tag:                         // Advanced Typographic Table
                    //MATH = MATHTable.Read(reader);
                    break;

                case MaxpTable.Tag:                         // Required Table
                    maxp = MaxpTable.Read(reader);
                    break;

                case MERGTable.Tag:                         // Other OpenType Table
                    //MERG = MERGTable.Read(reader);
                    break;

                case MetaTable.Tag:                         // Other OpenType Table
                    //meta = MetaTable.Read(reader);
                    break;

                case MVARTable.Tag:                         // OpenType Font Variations
                    //MVAR = MVARTable.Read(reader);
                    break;

                case NameTable.Tag:                         // Required Table
                    name = NameTable.Read(reader);
                    break;

                case OS2Table.Tag:                          // Required Table
                    //OS2 = OS2Table.Read(reader);
                    break;

                case PcltTable.Tag:                         // Other OpenType Table
                    pclt = PcltTable.Read(reader);
                    break;

                case PostTable.Tag:                         // Required Table
                    //post = PostTable.Read(reader, record);
                    break;

                case PrepTable.Tag:                         // Related to TrueType Outlines
                    prep = PrepTable.Read(reader, record);
                    break;

                case SbixTable.Tag:                         // Related to Bitmap Glyphs, Related to Color Fonts
                    sbix = SbixTable.Read(reader, maxp);
                    break;

                case STATTable.Tag:                         // OpenType Font Variations, Other OpenType Table
                    //STAT = STATTable.Read(reader);
                    break;

                case SVGTable.Tag:                          // Related to SVG Outlines, Related to Color Fonts
                    //SVG = SVGTable.Read(reader);
                    break;

                case VDMXTable.Tag:                         // Other OpenType Table
                    //VDMX = VDMXTable.Read(reader);
                    break;

                case VheaTable.Tag:                         // Other OpenType Table
                    //vhea = VheaTable.Read(reader);
                    break;

                case VmtxTable.Tag:                         // Other OpenType Table
                    //vmtx = VmtxTable.Read(reader);
                    break;

                case VORGTable.Tag:                         // Related to CFF Outlines
                    //VORG = VORGTable.Read(reader);
                    break;

                case VVARTable.Tag:                         // OpenType Font Variations
                    //VVAR = VVARTable.Read(reader);
                    break;
                }
                                #if DEBUG
                if (Font.IsDebug)
                {
                    memory = GC.GetTotalMemory(false) - memory;
                    Console.WriteLine("{0} memory: {1}", record.tableTag, memory);
                }
                                #endif
            }
        }