public virtual GlyphImage getGlyph(CachedFont font, int glyphCode) { GlyphImage g = getGlyphs(font)[glyphCode]; // System.out.println(g != null); if (g == null || g.cache.IsEmpty || g.cache.Width < 0) { return(null); } return(g); }
public virtual GlyphImage renderGlyph(CachedFont font, int glyphCode) { #if PENDING GlyphImage g = TextRenderer.renderGlyph(font.font, font.transform, glyphCode); g.cache = cacheImage.addImage(g); g.data = null; getGlyphs(font)[glyphCode] = g; return(g); #endif return(new GlyphImage()); }
public virtual GlyphImage[] getGlyphs(CachedFont font) { #if PENDING GlyphImage[] r = (GlyphImage[])fontMap.get_Renamed(font); if (r == null) { //UPGRADE_ISSUE: Method 'java.awt.Font.getNumGlyphs' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFontgetNumGlyphs_3"' r = new GlyphImage[font.font.getNumGlyphs()]; fontMap.put(font, r); } return(r); #endif return(new GlyphImage[0]); }
private void drawUsingTexture(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color) { #if PENDING System.Drawing.Drawing2D.Matrix at = Util.linearTransform(transform); GlyphCache.CachedFont drawFont = new GlyphCache.CachedFont(font, at); GlyphCache cache = Device.GlyphCache; Image img = (Image)cache.Image; double texm = 1.0 / img.getWidth(); context.renderer.color(context.context, color); context.renderer.beginText(context.context); context.renderer.setTextTexture(context.context, img.Id); for (int i = 0; i < glyphCodes.Length; i++) { GlyphImage g = cache.getGlyph(drawFont, glyphCodes[i]); if (g == null) { context.renderer.endText(context.context); g = cache.renderGlyph(drawFont, glyphCodes[i]); context.renderer.beginText(context.context); context.renderer.setTextTexture(context.context, img.Id); } if (g != null && !g.cache.IsEmpty && g.width > 0 && g.height > 0) { System.Drawing.Rectangle r = g.cache; double px = positions[i * 2]; double py = positions[i * 2 + 1]; double tpx = (float)transform.Elements.GetValue(0) * px + (float)transform.Elements.GetValue(2) * py + (System.Single)transform.OffsetX; double tpy = (float)transform.Elements.GetValue(1) * px + (float)transform.Elements.GetValue(3) * py + (System.Single)transform.OffsetY; double ix = System.Math.Floor(tpx + 0.5001) - g.x; double iy = System.Math.Floor(tpy + 0.5001) - g.y; //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"' context.renderer.drawGlyph(context.context, (float)(r.X * texm), (float)(r.Y * texm), (float)(r.Width * texm), (float)(r.Height * texm), (int)ix, (int)iy, g.width, g.height); } } context.renderer.endText(context.context); #endif }