示例#1
0
        public static EBDTTable Read(BinaryReaderFont reader, EBLCTable EBLC)
        {
            EBDTTable value = new EBDTTable();

            value.position     = reader.Position;
            value.filePath     = reader.FilePath;
            value.EBLC         = EBLC;
            value.majorVersion = reader.ReadUInt16();
            value.minorVersion = reader.ReadUInt16();
            //value.ReadBitmapData(reader, EBLC, position);
            return(value);
        }
示例#2
0
        public static EBLCTable Read(BinaryReaderFont reader)
        {
            long      position = reader.Position;
            EBLCTable value    = new EBLCTable {
                majorVersion = reader.ReadUInt16(),
                minorVersion = reader.ReadUInt16(),
                numSizes     = reader.ReadUInt32()
            };

            value.bitmapSizes = BitmapSize.ReadArray(reader, (int)value.numSizes);
            for (int i = 0; i < value.numSizes; i++)
            {
                value.bitmapSizes[i].ReadSubTableArray(reader, position);
                value.bitmapSizes[i].index = i;
            }
            return(value);
        }
示例#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
            }
        }
示例#4
0
        public static void DrawGlyph(RendererContext context)
        {
            EBLCTable EBLC = context.Font.Tables.EBLC;
            EBDTTable EBDT = context.Font.Tables.EBDT;

            //Bitmap bitmap = context.Bitmap;

            BitmapSize size = EBLC.GetBitmapSize(context.FontSize, context.FontSize);
            //Console.WriteLine("bitDepth: {0}", size.bitDepth);
            //Console.WriteLine("subTables.Length: {0}", size.subTables.Length);

            //for (int i = 0; i < size.subTables.Length; i++) {
            //	Console.WriteLine("subTables {0}: {1}", i, size.subTables[i]);
            //}
            //Console.WriteLine("flags: {0}", size.flags);

            //GlyphBitmapData data = EBDT.bitmapData[0x53F8];
            GlyphBitmapData data = EBDT.GetGlyphBitmapData(size.index, context.GlyphId);

            if (data == null)
            {
                data = EBDT.GetGlyphBitmapData(size.index, 0);
            }
            if (data == null)
            {
                context.X += context.FontSize;
                return;
            }
            //GlyphBitmapData data = EBDT.bitmapData[0x835];
            switch (data.format)
            {
            case 1:
                GlyphBitmapData1 data1 = data as GlyphBitmapData1;
                //Console.WriteLine("data7: {0}", data7);
                DrawImageData(
                    context,
                    size.bitDepth,
                    data1.smallMetrics,
                    data1.imageData
                    );
                break;

            case 2:
                GlyphBitmapData2 data2 = data as GlyphBitmapData2;
                //Console.WriteLine("data7: {0}", data7);
                DrawImageData(
                    context,
                    size.bitDepth,
                    data2.smallMetrics,
                    data2.imageData
                    );
                break;

            case 5:
                DrawBitmapData5(context, size, data as GlyphBitmapData5);
                break;

            case 6:
                GlyphBitmapData6 data6 = data as GlyphBitmapData6;
                //Console.WriteLine("data7: {0}", data);
                DrawImageData(
                    context,
                    size.bitDepth,
                    data6.bigMetrics,
                    data6.imageData
                    );
                break;

            case 7:
                GlyphBitmapData7 data7 = data as GlyphBitmapData7;
                //Console.WriteLine("data7: {0}", data7);
                DrawImageData(
                    context,
                    size.bitDepth,
                    data7.bigMetrics,
                    data7.imageData
                    );
                break;

            case 8:
                break;

            case 9:
                break;
            }
            //context.X += context.FontSize;
        }