From a5d593478afa2298282a0624b2490fde84c3a292 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 22 Mar 2023 16:55:04 +0100 Subject: Graph Font Processing: Use Font.GlyphVisitor instead of OutlineShape.Visitor, allowing to use the Glyph (information). --- src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/graphui') 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); -- cgit v1.2.3