summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-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
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java10
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java22
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java10
5 files changed, 28 insertions, 37 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);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index 9829bb426..f702b981f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -35,7 +35,6 @@ import jogamp.graph.font.typecast.ot.table.CmapIndexEntry;
import jogamp.graph.font.typecast.ot.table.CmapTable;
import jogamp.graph.font.typecast.ot.table.HdmxTable;
import jogamp.graph.font.typecast.ot.table.ID;
-import jogamp.graph.font.typecast.ot.table.NameTable;
import jogamp.graph.geom.plane.AffineTransform;
import jogamp.graph.geom.plane.Path2D;
@@ -141,12 +140,11 @@ class TypecastFont implements FontInt {
char2Glyph = new IntObjectHashMap(cmapentries + cmapentries/4);
}
- public String getName() {
- return font.getName();
+ public String getName(int nameIndex) {
+ return font.getName(nameIndex);
}
-
- public String getAllNames(String separator) {
- return font.getAllNames(separator);
+ public StringBuffer getAllNames(StringBuffer buffer, String separator) {
+ return font.getAllNames(buffer, separator);
}
public Metrics getMetrics() {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
index 2ac7e97d9..17b5af594 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -101,27 +101,19 @@ public class OTFont {
public OTFont(OTFontCollection fc) {
_fc = fc;
}
-
- public String getName() {
- if(null != _name) {
- StringBuffer sb = new StringBuffer();
- sb.append(_name.getRecordsRecordString(NameTable.RECORD_FAMILY)).append(" - ")
- .append(_name.getRecordsRecordString(NameTable.RECORD_SUBFAMILY)).append(" - ")
- .append(_name.getRecordsRecordString(NameTable.RECORD_MANUFACTURER)) ;
- return sb.toString();
- }
- return Table.notAvailable;
+ public String getName(int nameIndex) {
+ return _name.getRecordsRecordString(nameIndex);
}
-
- public String getAllNames(String separator) {
+ public StringBuffer getAllNames(StringBuffer sb, String separator) {
if(null != _name) {
- StringBuffer sb = new StringBuffer();
+ if(null == sb) {
+ sb = new StringBuffer();
+ }
for(int i=0; i<_name.getNumberOfNameRecords(); i++) {
sb.append(_name.getRecord(i).getRecordString()).append(separator);
}
- return sb.toString();
}
- return Table.notAvailable;
+ return sb;
}
public Table getTable(int tableType) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
index 72fde956c..cfaa7a2bc 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
@@ -63,16 +63,6 @@ import java.io.IOException;
* @author <a href="mailto:[email protected]">David Schweinsberg</a>
*/
public class NameTable implements Table {
-
- public static final int RECORD_COPYRIGHT = 0;
- public static final int RECORD_FAMILY = 1;
- public static final int RECORD_SUBFAMILY = 2;
- public static final int RECORD_UNIQUNAME = 3;
- public static final int RECORD_FULLNAME = 4;
- public static final int RECORD_VERSION = 5;
- public static final int RECORD_MANUFACTURER = 8;
- public static final int RECORD_DESIGNER = 9;
-
private DirectoryEntry _de;
private short _formatSelector;
private short _numberOfNameRecords;