summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/font
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java13
-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.java24
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java2
4 files changed, 58 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index 35c62a3d9..9829bb426 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -35,10 +35,12 @@ 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;
import com.jogamp.common.util.IntObjectHashMap;
+import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.geom.AABBox;
class TypecastFont implements FontInt {
@@ -140,7 +142,11 @@ class TypecastFont implements FontInt {
}
public String getName() {
- return fontset.getFileName();
+ return font.getName();
+ }
+
+ public String getAllNames(String separator) {
+ return font.getAllNames(separator);
}
public Metrics getMetrics() {
@@ -265,4 +271,9 @@ class TypecastFont implements FontInt {
final public int getNumGlyphs() {
return font.getNumGlyphs();
}
+
+ public boolean isPrintableChar( char c ) {
+ return FontFactory.isPrintableChar(c);
+ }
+
} \ No newline at end of file
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 3740dac6f..2ac7e97d9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -102,6 +102,28 @@ public class OTFont {
_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 getAllNames(String separator) {
+ if(null != _name) {
+ StringBuffer 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;
+ }
+
public Table getTable(int tableType) {
for (int i = 0; i < _tables.length; i++) {
if ((_tables[i] != null) && (_tables[i].getType() == 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 26cd067db..72fde956c 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
@@ -64,12 +64,21 @@ import java.io.IOException;
*/
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;
private short _stringStorageOffset;
private NameRecord[] _records;
-
+
protected NameTable(DirectoryEntry de, DataInput di) throws IOException {
_de = (DirectoryEntry) de.clone();
_formatSelector = di.readShort();
@@ -99,8 +108,19 @@ public class NameTable implements Table {
return _numberOfNameRecords;
}
+
public NameRecord getRecord(int i) {
- return _records[i];
+ if(_numberOfNameRecords > i) {
+ return _records[i];
+ }
+ return null;
+ }
+
+ public String getRecordsRecordString(int i) {
+ if(_numberOfNameRecords > i) {
+ return _records[i].getRecordString();
+ }
+ return Table.notAvailable;
}
public String getRecordString(short nameId) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
index 87bb0de7a..624f47bef 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
@@ -50,6 +50,8 @@ public interface Table {
public static final int vhea = 0x76686561; // Vertical Metrics header
public static final int vmtx = 0x766d7478; // Vertical Metrics
+ public static final String notAvailable = "n/a";
+
/**
* Get the table type, as a table directory value.
* @return The table type