public float getGlyphPixelWidth(final char unicodeID) { final Glyph glyph = getGlyph(unicodeID); if (glyph != null) { return glyph.getAdvance(); } // Have to do this the hard / uncached way singleUnicode[0] = unicodeID; if( null == fontRenderContext ) { // FIXME: Never initialized! throw new InternalError("fontRenderContext never initialized!"); } final GlyphVector gv = font.createGlyphVector(fontRenderContext, singleUnicode); return gv.getGlyphMetrics(0).getAdvance(); }
private void upload() { final GlyphVector gv = getGlyphVector(); final Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(gv, getFontRenderContext())); final Rectangle2D bbox = normalize(origBBox);
private Glyph getGlyph(final int unicodeID, final GlyphVector singleUnicodeGlyphVector, final GlyphMetrics metrics) { final int glyphCode = singleUnicodeGlyphVector.getGlyphCode(0); // Have seen huge glyph codes (65536) coming out of some fonts in some Unicode situations if (glyphCode >= glyphCache.length) { return null; } final Glyph glyph = new Glyph(unicodeID, glyphCode, metrics.getAdvance(), singleUnicodeGlyphVector, this); register(glyph); return glyph; } }
public void register(final Glyph glyph) { unicodes2Glyphs[glyph.getUnicodeID()] = glyph.getGlyphCode(); glyphCache[glyph.getGlyphCode()] = glyph; }
public void clearCacheEntry(final int unicodeID) { final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { final Glyph glyph = glyphCache[glyphID]; if (glyph != null) { glyph.clear(); } glyphCache[glyphID] = null; } unicodes2Glyphs[unicodeID] = undefined; }
private void internal_draw3D(final CharSequence str, float x, final float y, final float z, final float scaleFactor) { for (final Glyph glyph : mGlyphProducer.getGlyphs(str)) { final float advance = glyph.draw3D(x, y, z, scaleFactor); x += advance * scaleFactor; } }