diff options
author | Sven Gothel <[email protected]> | 2023-03-22 16:55:04 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-22 16:55:04 +0100 |
commit | a5d593478afa2298282a0624b2490fde84c3a292 (patch) | |
tree | 9a995fe24f8617e42a75475d0755e5da1944ebdb /src/graphui/classes/com/jogamp | |
parent | 960af62429aef3ec573a7f6fa3ed6b0f5552376f (diff) |
Graph Font Processing: Use Font.GlyphVisitor instead of OutlineShape.Visitor, allowing to use the Glyph (information).
Diffstat (limited to 'src/graphui/classes/com/jogamp')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java index e55526fd7..17ea3ad4e 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java @@ -34,6 +34,7 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.graph.ui.gl.Shape; @@ -159,9 +160,13 @@ public class Label extends Shape { return GLRegion.create(glp, getRenderModes(), null, font, text); } - private final OutlineShape.Visitor shapeVisitor = new OutlineShape.Visitor() { + private final Font.GlyphVisitor glyphVisitor = new Font.GlyphVisitor() { @Override - public void visit(final OutlineShape shape, final AffineTransform t) { + public void visit(final Glyph glyph, final AffineTransform t) { + if( glyph.isWhiteSpace() ) { + return; + } + final OutlineShape shape = glyph.getShape(); shape.setSharpness(oshapeSharpness); try { region.addOutlineShape(shape, t, rgbaColor); @@ -178,7 +183,7 @@ public class Label extends Shape { @Override protected void addShapeToRegion() { tempT1.setToScale(fontScale, fontScale); - final AABBox fbox = font.processString(shapeVisitor, tempT1, text, tempT2, tempT3); + final AABBox fbox = font.processString(glyphVisitor, tempT1, text, tempT2, tempT3); final float[] ctr = fbox.getCenter(); setRotationOrigin( ctr[0], ctr[1], ctr[2]); box.copy(fbox); |