diff options
author | Sven Gothel <[email protected]> | 2023-04-14 17:46:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-14 17:46:30 +0200 |
commit | a31c3487bebdded597ff8a76b48399ae5691f843 (patch) | |
tree | 60bf6ef7a869fdd7dc35cfc493b3c2ed16a02459 /src/jogl/classes/jogamp | |
parent | ac4e63b87cc311004de65230688911df538f0866 (diff) |
Typecast Font.getGlyph(..): Fix Glyph case w/ 0 getOutlineVectexCount() -> isWhiteSpace = true, use emptyShape
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index d981e09aa..8a9ad8bab 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -203,6 +203,7 @@ class TypecastFont implements Font { } else { glyph_name = ""; } + final int glyph_height = metrics.getAscentFU() - metrics.getDescentFU(); final int glyph_advance; final int glyph_leftsidebearings; final AABBox glyph_bbox; @@ -211,11 +212,20 @@ class TypecastFont implements Font { if( null != glyph ) { glyph_advance = glyph.getAdvanceWidth(); glyph_leftsidebearings = glyph.getLeftSideBearing(); - glyph_bbox = glyph.getBBox(); - shape = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph, OutlineShape.getDefaultVertexFactory()); - isWhiteSpace = false; + final AABBox sb = glyph.getBBox(); + final OutlineShape s = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph, OutlineShape.getDefaultVertexFactory()); + if( 0 < s.getOutlineVectexCount() ) { + glyph_bbox = sb; + shape = s; + isWhiteSpace = false; + } else { + // non-contour glyph -> whitespace + glyph_bbox = new AABBox(0f,0f,0f, glyph_advance, glyph_height, 0f); + shape = TypecastRenderer.buildEmptyShape(metrics.getUnitsPerEM(), glyph_bbox, OutlineShape.getDefaultVertexFactory()); + isWhiteSpace = true; + } } else { - final int glyph_height = metrics.getAscentFU() - metrics.getDescentFU(); + // non-contour glyph -> whitespace glyph_advance = getAdvanceWidthFU(glyph_id); glyph_leftsidebearings = 0; glyph_bbox = new AABBox(0f,0f,0f, glyph_advance, glyph_height, 0f); |