aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-28 02:41:30 +0200
committerSven Gothel <[email protected]>2023-03-28 02:41:30 +0200
commit114cc7be0f43a6cf2540caa0ed47948d7cade54f (patch)
tree81d3299240789be44c4f82eb1c345e72931e9bd1 /src/jogl
parentf7125f6bb2db418064a170ae42466e13b8f51f70 (diff)
Graph Font.GlyphVisitor*: Pass 'char symbol' to visitor, passing full text-processing information
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java3
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java4
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java6
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java8
4 files changed, 11 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 6797a266c..402a238c9 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -43,6 +43,7 @@ import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.texture.TextureSequence;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.font.Font;
+import com.jogamp.graph.font.Font.Glyph;
import java.io.PrintStream;
@@ -152,7 +153,7 @@ public abstract class GLRegion extends Region {
final int[] vertIndexCount = { 0, 0 };
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@Override
- public final void visit(final Font.Glyph glyph) {
+ public final void visit(final char symbol, final Font.Glyph glyph) {
region.countOutlineShape(glyph.getShape(), vertIndexCount);
} };
font.processString(visitor, str);
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 35b6d5028..237d93184 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -109,7 +109,7 @@ public class TextRegionUtil {
final AffineTransform temp1, final AffineTransform temp2) {
final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
@Override
- public void visit(final Glyph glyph, final AffineTransform t) {
+ public void visit(final char symbol, final Glyph glyph, final AffineTransform t) {
if( glyph.isWhiteSpace() ) {
return;
}
@@ -135,7 +135,7 @@ public class TextRegionUtil {
public static void countStringRegion(final Region region, final Font font, final CharSequence str, final int[/*2*/] vertIndexCount) {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@Override
- public final void visit(final Font.Glyph glyph) {
+ public final void visit(final char symbol, final Font.Glyph glyph) {
region.countOutlineShape(glyph.getShape(), vertIndexCount);
} };
font.processString(visitor, str);
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 2fb9b94ab..4399bbad7 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -258,10 +258,11 @@ public interface Font {
public static interface GlyphVisitor {
/**
* Visiting the given {@link Font.Glyph} having an {@link OutlineShape} with it's corresponding {@link AffineTransform}.
+ * @param symbol the character symbol matching the given glyph
* @param glyph {@link Font.Glyph} which contains an {@link OutlineShape} via {@link Font.Glyph#getShape()}.
* @param t may be used immediately as is, otherwise a copy shall be made if stored.
*/
- public void visit(final Glyph glyph, final AffineTransform t);
+ public void visit(final char symbol, final Glyph glyph, final AffineTransform t);
}
/**
@@ -270,9 +271,10 @@ public interface Font {
public static interface GlyphVisitor2 {
/**
* Visiting the given {@link Font.Glyph} having an {@link OutlineShape}.
+ * @param symbol the character symbol matching the given glyph
* @param glyph {@link Font.Glyph} which contains an {@link OutlineShape} via {@link Font.Glyph#getShape()}.
*/
- public void visit(final Glyph glyph);
+ public void visit(final char symbol, final Glyph glyph);
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index 7dc20e47f..dcf8ce56c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -31,8 +31,6 @@ import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.geom.Vertex.Factory;
import com.jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.opengl.math.geom.AABBox;
@@ -359,7 +357,7 @@ class TypecastFont implements Font {
}
final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
@Override
- public final void visit(final Font.Glyph shape, final AffineTransform t) {
+ public final void visit(final char symbol, final Font.Glyph shape, final AffineTransform t) {
// nop
} };
return processString(visitor, transform, string);
@@ -419,7 +417,7 @@ class TypecastFont implements Font {
}
temp1.translate(advanceTotal, y, temp2);
res.resize(temp1.transform(glyphShape.getBounds(), temp_box));
- visitor.visit(glyph, temp1);
+ visitor.visit(character, glyph, temp1);
advanceTotal += glyph.getAdvance();
left_glyph = glyph;
}
@@ -439,7 +437,7 @@ class TypecastFont implements Font {
if( '\n' != character ) {
final Glyph glyph = getGlyph(getGlyphID(character));
if( null != glyph.getShape() ) { // also covers 'space' and all non-contour symbols
- visitor.visit(glyph);
+ visitor.visit(character, glyph);
}
}
}