diff options
author | Sven Gothel <[email protected]> | 2023-02-12 00:57:01 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-12 00:57:01 +0100 |
commit | 8bf9b05ea13978f214c29d5b1220da3cad2489dd (patch) | |
tree | 5b0d4b0b3cb34b7f624e329e5d6cc5ee2e041872 /src/jogl/classes/jogamp/graph/font | |
parent | cb2b1c0af77b4f2318fb5acafbced52d1add69ae (diff) |
Typecast: Table: Use package-protected static final const, remove notAvailable String
Diffstat (limited to 'src/jogl/classes/jogamp/graph/font')
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java | 24 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java | 76 |
2 files changed, 49 insertions, 51 deletions
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 e04f89e1e..2aca34416 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,28 +64,28 @@ import java.io.IOException; public class NameTable implements Table { @SuppressWarnings("unused") - private short _formatSelector; - private short _numberOfNameRecords; - private short _stringStorageOffset; - private NameRecord[] _records; + private final short _formatSelector; + private final short _numberOfNameRecords; + private final short _stringStorageOffset; + private final NameRecord[] _records; - public NameTable(DataInput di, int length) throws IOException { + public NameTable(final DataInput di, final int length) throws IOException { _formatSelector = di.readShort(); _numberOfNameRecords = di.readShort(); _stringStorageOffset = di.readShort(); _records = new NameRecord[_numberOfNameRecords]; - + // Load the records, which contain the encoding information and string // offsets for (int i = 0; i < _numberOfNameRecords; i++) { _records[i] = new NameRecord(di); } - + // Load the string data into a buffer so the records can copy out the // bits they are interested in - byte[] buffer = new byte[length - _stringStorageOffset]; + final byte[] buffer = new byte[length - _stringStorageOffset]; di.readFully(buffer); - + // Now let the records get their hands on them for (int i = 0; i < _numberOfNameRecords; i++) { _records[i].loadString( @@ -109,12 +109,12 @@ public class NameTable implements Table { if(_numberOfNameRecords > i) { return _records[i].getRecordString(); } else { - return Table.notAvailable; + return ""; } } - + /** Return a named record string */ - public String getRecordString(short nameId) { + public String getRecordString(final short nameId) { // Search for the first instance of this name ID for (int i = 0; i < _numberOfNameRecords; i++) { if (_records[i].getNameId() == 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 bf0d1c6f5..cac75ebc9 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 @@ -23,44 +23,42 @@ package jogamp.graph.font.typecast.ot.table; public interface Table { // Table constants - public static final int BASE = 0x42415345; // Baseline data [OpenType] - public static final int CFF = 0x43464620; // PostScript font program (compact font format) [PostScript] - public static final int COLR = 0x434f4c52; // Color Table - public static final int CPAL = 0x4350414c; // Color Palette Table - public static final int DSIG = 0x44534947; // Digital signature - public static final int EBDT = 0x45424454; // Embedded bitmap data - public static final int EBLC = 0x45424c43; // Embedded bitmap location data - public static final int EBSC = 0x45425343; // Embedded bitmap scaling data - public static final int GDEF = 0x47444546; // Glyph definition data [OpenType] - public static final int GPOS = 0x47504f53; // Glyph positioning data [OpenType] - public static final int GSUB = 0x47535542; // Glyph substitution data [OpenType] - public static final int JSTF = 0x4a535446; // Justification data [OpenType] - public static final int LTSH = 0x4c545348; // Linear threshold table - public static final int MMFX = 0x4d4d4658; // Multiple master font metrics [PostScript] - public static final int MMSD = 0x4d4d5344; // Multiple master supplementary data [PostScript] - public static final int OS_2 = 0x4f532f32; // OS/2 and Windows specific metrics [r] - public static final int PCLT = 0x50434c54; // PCL5 - public static final int VDMX = 0x56444d58; // Vertical Device Metrics table - public static final int cmap = 0x636d6170; // character to glyph mapping [r] - public static final int cvt = 0x63767420; // Control Value Table - public static final int fpgm = 0x6670676d; // font program - public static final int fvar = 0x66766172; // Apple's font variations table [PostScript] - public static final int gasp = 0x67617370; // grid-fitting and scan conversion procedure (grayscale) - public static final int glyf = 0x676c7966; // glyph data [r] - public static final int hdmx = 0x68646d78; // horizontal device metrics - public static final int head = 0x68656164; // font header [r] - public static final int hhea = 0x68686561; // horizontal header [r] - public static final int hmtx = 0x686d7478; // horizontal metrics [r] - public static final int kern = 0x6b65726e; // kerning - public static final int loca = 0x6c6f6361; // index to location [r] - public static final int maxp = 0x6d617870; // maximum profile [r] - public static final int name = 0x6e616d65; // naming table [r] - public static final int prep = 0x70726570; // CVT Program - public static final int post = 0x706f7374; // PostScript information [r] - public static final int sbix = 0x73626978; // Extended Bitmaps - public static final int vhea = 0x76686561; // Vertical Metrics header - public static final int vmtx = 0x766d7478; // Vertical Metrics - - public static final String notAvailable = "n/a"; + static final int BASE = 0x42415345; // Baseline data [OpenType] + static final int CFF = 0x43464620; // PostScript font program (compact font format) [PostScript] + static final int COLR = 0x434f4c52; // Color Table + static final int CPAL = 0x4350414c; // Color Palette Table + static final int DSIG = 0x44534947; // Digital signature + static final int EBDT = 0x45424454; // Embedded bitmap data + static final int EBLC = 0x45424c43; // Embedded bitmap location data + static final int EBSC = 0x45425343; // Embedded bitmap scaling data + static final int GDEF = 0x47444546; // Glyph definition data [OpenType] + static final int GPOS = 0x47504f53; // Glyph positioning data [OpenType] + static final int GSUB = 0x47535542; // Glyph substitution data [OpenType] + static final int JSTF = 0x4a535446; // Justification data [OpenType] + static final int LTSH = 0x4c545348; // Linear threshold table + static final int MMFX = 0x4d4d4658; // Multiple master font metrics [PostScript] + static final int MMSD = 0x4d4d5344; // Multiple master supplementary data [PostScript] + static final int OS_2 = 0x4f532f32; // OS/2 and Windows specific metrics [r] + static final int PCLT = 0x50434c54; // PCL5 + static final int VDMX = 0x56444d58; // Vertical Device Metrics table + static final int cmap = 0x636d6170; // character to glyph mapping [r] + static final int cvt = 0x63767420; // Control Value Table + static final int fpgm = 0x6670676d; // font program + static final int fvar = 0x66766172; // Apple's font variations table [PostScript] + static final int gasp = 0x67617370; // grid-fitting and scan conversion procedure (grayscale) + static final int glyf = 0x676c7966; // glyph data [r] + static final int hdmx = 0x68646d78; // horizontal device metrics + static final int head = 0x68656164; // font header [r] + static final int hhea = 0x68686561; // horizontal header [r] + static final int hmtx = 0x686d7478; // horizontal metrics [r] + static final int kern = 0x6b65726e; // kerning + static final int loca = 0x6c6f6361; // index to location [r] + static final int maxp = 0x6d617870; // maximum profile [r] + static final int name = 0x6e616d65; // naming table [r] + static final int prep = 0x70726570; // CVT Program + static final int post = 0x706f7374; // PostScript information [r] + static final int sbix = 0x73626978; // Extended Bitmaps + static final int vhea = 0x76686561; // Vertical Metrics header + static final int vmtx = 0x766d7478; // Vertical Metrics } |