public GlyphBitmapData GetGlyphBitmapData(int index, int glyphId) { if (index < 0 || index >= EBLC.bitmapSizes.Length) { return(null); } if (File.Exists(filePath) == false) { return(null); } BitmapSize size = EBLC.bitmapSizes[index]; IndexSubTableArray array = size.FindSubTableArray(glyphId); if (array == null) { return(null); } using (Stream stream = File.OpenRead(filePath)) using (BinaryReaderFont reader = new BinaryReaderFont(stream)) { reader.Position = position + array.subTable.header.imageDataOffset; return(array.subTable.ReadBitmapData(reader, glyphId, glyphId - array.firstGlyphIndex)); } /* * if (index < 0 || index >= bitmapData.Count) { * return null; * } * if (bitmapData[index].ContainsKey((ushort)glyphId) == false) { * return null; * } * return bitmapData[index][(ushort)glyphId]; * //*/ }
protected static void DrawBitmapData5(RendererContext context, BitmapSize size, GlyphBitmapData5 data) { //Console.WriteLine("data5: {0}", data5); BigGlyphMetrics bigMetrics = null; IndexSubTableArray subTable = size.FindSubTableArray(context.GlyphId); if (subTable != null) { //Console.WriteLine("Size 2: {0}", context.GlyphId); //Console.WriteLine("Size 3: {0}", subTable); bigMetrics = subTable.GetBigGlyphMetrics(); //Console.WriteLine("Size 4: {0}", metrics); } if (bigMetrics != null) { DrawImageData( context, size.bitDepth, bigMetrics, data.imageData ); } else { DrawImageData( context, size.bitDepth, size.hori.widthMax, context.FontSize, data.imageData ); context.X += context.FontSize; } }