aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-01 20:07:04 +0200
committerSven Gothel <[email protected]>2011-04-01 20:07:04 +0200
commit5857d93e2d41608b247ec18cb9129f3a6624d9ac (patch)
tree38b1ab9b489b9e249a9d2495aa528db1fbee3288 /src/jogl/classes/com
parent85c3bcac2ef65aa7c6a5a4990f1e2559d691a361 (diff)
Font Names: Expose name indices allowing user to pick all names ..
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java8
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java15
2 files changed, 17 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
index 2bb99d27c..79ae8c11e 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -55,13 +55,13 @@ public abstract class TextRenderer extends Renderer {
Path2D[] paths = new Path2D[str.length()];
((FontInt)font).getOutline(str, size, affineTransform, paths);
- GlyphString glyphString = new GlyphString(pointFactory, font.getName(), str);
+ GlyphString glyphString = new GlyphString(pointFactory, font.getName(Font.NAME_UNIQUNAME), str);
glyphString.createfromFontPath(paths, affineTransform);
glyphString.generateRegion(gl.getContext(), sharpness, st, renderType);
return glyphString;
}
-
+
public void flushCache() {
Iterator<GlyphString> iterator = stringCacheMap.values().iterator();
while(iterator.hasNext()){
@@ -84,12 +84,12 @@ public abstract class TextRenderer extends Renderer {
}
protected GlyphString getCachedGlyphString(Font font, String str, int fontSize) {
- final String key = font.getName() + "." + str.hashCode() + "." + fontSize;
+ final String key = font.getName(Font.NAME_UNIQUNAME) + "." + str.hashCode() + "." + fontSize;
return stringCacheMap.get(key);
}
protected void addCachedGlyphString(Font font, String str, int fontSize, GlyphString glyphString) {
- final String key = font.getName() + "." + str.hashCode() + "." + fontSize;
+ final String key = font.getName(Font.NAME_UNIQUNAME) + "." + str.hashCode() + "." + fontSize;
validateCache(1);
stringCacheMap.put(key, glyphString);
stringCacheArray.add(stringCacheArray.size(), key);
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index a34e81ccd..d8c30c61b 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -41,6 +41,17 @@ import com.jogamp.graph.geom.AABBox;
public interface Font {
+ /** font name indices for name table */
+ public static final int NAME_COPYRIGHT = 0;
+ public static final int NAME_FAMILY = 1;
+ public static final int NAME_SUBFAMILY = 2;
+ public static final int NAME_UNIQUNAME = 3;
+ public static final int NAME_FULLNAME = 4;
+ public static final int NAME_VERSION = 5;
+ public static final int NAME_MANUFACTURER = 8;
+ public static final int NAME_DESIGNER = 9;
+
+
/**
* Metrics for font
*
@@ -70,8 +81,8 @@ public interface Font {
}
- public String getName();
- public String getAllNames(String separator);
+ public String getName(int nameIndex);
+ public StringBuffer getAllNames(StringBuffer buffer, String separator);
public Metrics getMetrics();
public Glyph getGlyph(char symbol);