public const int SIZE = 5; //size of SmallGlyphMetrics public static void ReadSmallGlyphMetric(BinaryReader reader, ref SmallGlyphMetrics output) { output.height = reader.ReadByte(); output.width = reader.ReadByte(); output.bearingX = (sbyte)reader.ReadByte(); output.bearingY = (sbyte)reader.ReadByte(); output.advance = reader.ReadByte(); }
//Format 17: small metrics, PNG image data //Type Name Description //smallGlyphMetrics glyphMetrics Metrics information for the glyph //uint32 dataLen Length of data in bytes //uint8 data[dataLen] Raw PNG data public override void FillGlyphInfo(BinaryReader reader, Glyph bitmapGlyph) { SmallGlyphMetrics.ReadSmallGlyphMetric(reader, out SmallGlyphMetrics smallGlyphMetric); bitmapGlyph.BitmapGlyphAdvanceWidth = smallGlyphMetric.advance; bitmapGlyph.Bounds = new Bounds(0, 0, smallGlyphMetric.width, smallGlyphMetric.height); //then //byte[] buff = reader.ReadBytes((int)dataLen); //System.IO.File.WriteAllBytes("testBitmapGlyph_" + glyph.GlyphIndex + ".png", buff); }
//Format 17: small metrics, PNG image data //Type Name Description //smallGlyphMetrics glyphMetrics Metrics information for the glyph //uint32 dataLen Length of data in bytes //uint8 data[dataLen] Raw PNG data public override void FillGlyphInfo(BinaryReader reader, Glyph bitmapGlyph) { SmallGlyphMetrics smallGlyphMetric = new SmallGlyphMetrics(); SmallGlyphMetrics.ReadSmallGlyphMetric(reader, ref smallGlyphMetric); uint dataLen = reader.ReadUInt32(); bitmapGlyph.OriginalAdvanceWidth = smallGlyphMetric.advance; bitmapGlyph.Bounds = new Bounds(0, 0, smallGlyphMetric.width, smallGlyphMetric.height); //then //byte[] buff = reader.ReadBytes((int)dataLen); //System.IO.File.WriteAllBytes("d:\\WImageTest\\testBitmapGlyph_" + glyph.GlyphIndex + ".png", buff); }