summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-06 15:57:16 +0200
committerSven Gothel <[email protected]>2011-05-06 15:57:16 +0200
commitf5aaaf5cd65dedba658392cc30edb24b0dc3c026 (patch)
tree6b634c6ce5ffc5645a1e38abd65f610a67913290 /src/jogl
parenteeb7c5fae3caf508fe5a6021ce700630632c6a02 (diff)
Graph / Text: Use CharSequence as char/string interface to text rendering
Implements more of John Pritchard <[email protected]> proposal https://github.com/syntelos/jogl/commit/eadee0758babcddaa5eeaffbe046e1b09f9f550e
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphString.java10
-rw-r--r--src/jogl/classes/jogamp/graph/font/FontInt.java2
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java8
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 1010d4f1a..a942c7a58 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -88,8 +88,8 @@ public interface Font {
public Glyph getGlyph(char symbol);
public int getNumGlyphs();
- public float getStringWidth(String string, float pixelSize);
- public float getStringHeight(String string, float pixelSize);
+ public float getStringWidth(CharSequence string, float pixelSize);
+ public float getStringHeight(CharSequence string, float pixelSize);
public AABBox getStringBounds(CharSequence string, float pixelSize);
public boolean isPrintableChar( char c );
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<GlyphShape> glyphs = new ArrayList<GlyphShape>();
- 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<string.length(); i++)
@@ -274,4 +274,4 @@ class TypecastFont implements FontInt {
return FontFactory.isPrintableChar(c);
}
-} \ No newline at end of file
+}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
index c8861d744..f3029b1e4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
@@ -41,7 +41,7 @@ import com.jogamp.graph.font.Font;
public class TypecastRenderer {
public static void getPaths(TypecastFont font,
- String string, float pixelSize, AffineTransform transform, Path2D[] p)
+ CharSequence string, float pixelSize, AffineTransform transform, Path2D[] p)
{
if (string == null) {
return;