From f5aaaf5cd65dedba658392cc30edb24b0dc3c026 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 May 2011 15:57:16 +0200 Subject: Graph / Text: Use CharSequence as char/string interface to text rendering Implements more of John Pritchard proposal https://github.com/syntelos/jogl/commit/eadee0758babcddaa5eeaffbe046e1b09f9f550e --- src/jogl/classes/jogamp/graph/curve/text/GlyphString.java | 10 +++++----- src/jogl/classes/jogamp/graph/font/FontInt.java | 2 +- src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 8 ++++---- .../classes/jogamp/graph/font/typecast/TypecastRenderer.java | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index a904c2b48..852d84f5a 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -45,12 +45,11 @@ import jogamp.graph.geom.plane.PathIterator; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.RegionFactory; import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.opengl.util.glsl.ShaderState; public class GlyphString { private ArrayList glyphs = new ArrayList(); - private String str = ""; - private String fontname = ""; + private CharSequence str; + private String fontname; private Region region; private SVertex origin = new SVertex(); @@ -60,7 +59,7 @@ public class GlyphString { * associated with * @param str the string object */ - public GlyphString(String fontname, String str){ + public GlyphString(String fontname, CharSequence str){ this.fontname = fontname; this.str = str; } @@ -68,7 +67,8 @@ public class GlyphString { public void addGlyphShape(GlyphShape glyph){ glyphs.add(glyph); } - public String getString(){ + + public CharSequence getString(){ return str; } diff --git a/src/jogl/classes/jogamp/graph/font/FontInt.java b/src/jogl/classes/jogamp/graph/font/FontInt.java index f915d57f0..6c25f9a80 100644 --- a/src/jogl/classes/jogamp/graph/font/FontInt.java +++ b/src/jogl/classes/jogamp/graph/font/FontInt.java @@ -46,7 +46,7 @@ public interface FontInt extends Font { public Path2D getPath(float pixelSize); } - public void getPaths(String string, float pixelSize, + public void getPaths(CharSequence string, float pixelSize, AffineTransform transform, Path2D[] result); //TODO: Rami - ADD getOutlines without path2D } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index dae5b3333..2e5774622 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -199,11 +199,11 @@ class TypecastFont implements FontInt { return result; } - public void getPaths(String string, float pixelSize, AffineTransform transform, Path2D[] result) { + public void getPaths(CharSequence string, float pixelSize, AffineTransform transform, Path2D[] result) { TypecastRenderer.getPaths(this, string, pixelSize, transform, result); } - public float getStringWidth(String string, float pixelSize) { + public float getStringWidth(CharSequence string, float pixelSize) { float width = 0; final int len = string.length(); for (int i=0; i< len; i++) @@ -220,7 +220,7 @@ class TypecastFont implements FontInt { return (int)(width + 0.5f); } - public float getStringHeight(String string, float pixelSize) { + public float getStringHeight(CharSequence string, float pixelSize) { int height = 0; for (int i=0; i