From 3bad09f6b7c7f9c93a6cf385abb51a6563e8aec0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 7 Mar 2023 19:05:05 +0100 Subject: Graph Perf: Add Region.countOutlineShape(), Font.processString(Visitor2,..), TextRegionUtil.countStringRegion() allowing to use Region.setBufferCapacity() --- .../jogamp/graph/font/typecast/TypecastFont.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/jogamp') 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; @@ -424,6 +419,24 @@ class TypecastFont implements Font { return res; } + @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(); -- cgit v1.2.3