summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-07 19:05:05 +0100
committerSven Gothel <[email protected]>2023-03-07 19:05:05 +0100
commit3bad09f6b7c7f9c93a6cf385abb51a6563e8aec0 (patch)
tree456cf2320e4d8b6970bc401f25d68efa28ad2ae6 /src/jogl/classes/jogamp
parent5e79fea8981a13d155e0b958aa3e20a546c533bb (diff)
Graph Perf: Add Region.countOutlineShape(), Font.processString(Visitor2,..), TextRegionUtil.countStringRegion() allowing to use Region.setBufferCapacity()
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index c2c66bd36..003795942 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -42,12 +42,7 @@ import jogamp.graph.font.typecast.ot.table.KernTable;
import jogamp.graph.font.typecast.ot.table.KerningPair;
import jogamp.graph.font.typecast.ot.table.PostTable;
-import java.io.PrintStream;
-import java.util.concurrent.TimeUnit;
-
-import com.jogamp.common.os.Clock;
import com.jogamp.common.util.IntObjectHashMap;
-import com.jogamp.common.util.PerfCounterCtrl;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
@@ -425,6 +420,24 @@ class TypecastFont implements Font {
}
@Override
+ public void processString(final OutlineShape.Visitor2 visitor, final CharSequence string) {
+ if (null == string || 0 == string.length() ) {
+ return;
+ }
+ final int charCount = string.length();
+
+ for(int i=0; i< charCount; i++) {
+ final char character = string.charAt(i);
+ if( '\n' != character ) {
+ final OutlineShape glyphShape = getGlyph(getGlyphID(character)).getShape();
+ if( null != glyphShape ) { // also covers 'space' and all non-contour symbols
+ visitor.visit(glyphShape);
+ }
+ }
+ }
+ }
+
+ @Override
final public int getNumGlyphs() {
return font.getNumGlyphs();
}