From 842d26748d6eaf7fde33dced3a33aef60f09d7d3 Mon Sep 17 00:00:00 2001
From: Bernhard Haumacher <haui@haumacher.de>
Date: Sat, 3 Feb 2024 01:42:00 +0100
Subject: Documentation for `HeadTable`

* Added documentation to fields in `HeadTable` taken from
https://docs.microsoft.com/en-us/typography/opentype/spec/head.
* Added `LongDateTime` conversion of date values encoded as "seconds
since 1904".
* Added `getType()` API to `Table` interface.
# Conflicts:
#	src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
#	src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
#	src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
#	src/jogl/classes/jogamp/graph/font/typecast/ot/table/SbixTable.java

Original commit from typecast merge:

From 43c20bb2e7644aef7002caeb93e1770be5cacaab Mon Sep 17 00:00:00 2001
From: Bernhard Haumacher <haui@haumacher.de>
Date: Sat, 9 May 2020 12:49:39 +0200
---
 .../jogamp/graph/font/typecast/ot/Fixed.java       |   3 +
 .../graph/font/typecast/ot/table/BaseTable.java    |   2 +-
 .../graph/font/typecast/ot/table/CffTable.java     |   5 +
 .../graph/font/typecast/ot/table/CmapTable.java    |   6 +-
 .../graph/font/typecast/ot/table/ColrTable.java    |   5 +
 .../graph/font/typecast/ot/table/CpalTable.java    |   5 +
 .../graph/font/typecast/ot/table/CvtTable.java     |   5 +
 .../graph/font/typecast/ot/table/DsigTable.java    |   7 +-
 .../graph/font/typecast/ot/table/FpgmTable.java    |   5 +
 .../graph/font/typecast/ot/table/GaspTable.java    |   5 +
 .../graph/font/typecast/ot/table/GdefTable.java    |   5 +
 .../graph/font/typecast/ot/table/GlyfTable.java    |   5 +
 .../graph/font/typecast/ot/table/GposTable.java    |   5 +
 .../graph/font/typecast/ot/table/GsubTable.java    |   5 +
 .../graph/font/typecast/ot/table/HdmxTable.java    |   4 +
 .../graph/font/typecast/ot/table/HeadTable.java    | 338 ++++++++++++++++++---
 .../graph/font/typecast/ot/table/HheaTable.java    |   5 +
 .../graph/font/typecast/ot/table/HmtxTable.java    |   5 +
 .../graph/font/typecast/ot/table/KernTable.java    |   5 +
 .../graph/font/typecast/ot/table/LocaTable.java    |   8 +-
 .../graph/font/typecast/ot/table/LtshTable.java    |   5 +
 .../graph/font/typecast/ot/table/MaxpTable.java    |   5 +
 .../graph/font/typecast/ot/table/NameTable.java    |   7 +-
 .../graph/font/typecast/ot/table/Os2Table.java     |   5 +
 .../graph/font/typecast/ot/table/PcltTable.java    |   5 +
 .../graph/font/typecast/ot/table/PostTable.java    |   5 +
 .../graph/font/typecast/ot/table/PrepTable.java    |   5 +
 .../graph/font/typecast/ot/table/SbixTable.java    |   5 +
 .../jogamp/graph/font/typecast/ot/table/Table.java |   4 +
 .../graph/font/typecast/ot/table/VdmxTable.java    |   5 +
 .../graph/font/typecast/ot/table/VheaTable.java    |   5 +
 .../graph/font/typecast/ot/table/VmtxTable.java    |   5 +
 32 files changed, 439 insertions(+), 55 deletions(-)

(limited to 'src/jogl/classes/jogamp')

diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
index 94243cf21..2d9d4e4b7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
@@ -838,6 +838,9 @@ public class Fixed {
         return n;
     }
     
+    /**
+     * Converts a 32-bit signed fixed-point number (16.16) to <code>float</code>.
+     */
     public static float floatValue(long fixed) {
         return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
index 51f64494d..8ada558e8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
@@ -27,7 +27,7 @@ import java.io.IOException;
  * Baseline Table
  * @author <a href="mailto:david.schweinsberg@gmail.com">David Schweinsberg</a>
  */
-public class BaseTable implements Table {
+public abstract class BaseTable implements Table {
     
     private abstract static class BaseCoord {
 
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
index 5bb14c73d..db7748cc7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
@@ -102,6 +102,11 @@ public class CffTable implements Table {
                 _buf, offset,
                 _buf.length - offset));
     }
+    
+    @Override
+    public int getType() {
+        return CFF;
+    }
 
     public NameIndex getNameIndex() {
         return _nameIndex;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
index dd5e9bc02..35fdb1c22 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
@@ -52,7 +52,6 @@ package jogamp.graph.font.typecast.ot.table;
 
 import java.io.DataInput;
 import java.io.IOException;
-
 import java.util.Arrays;
 
 /**
@@ -103,6 +102,11 @@ public class CmapTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return cmap;
+    }
+
     public int getVersion() {
         return _version;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ColrTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ColrTable.java
index 13d4f2c6b..75c3b2ec7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ColrTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ColrTable.java
@@ -103,6 +103,11 @@ class ColrTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return COLR;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CpalTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CpalTable.java
index f8122c730..03e3d2432 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CpalTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CpalTable.java
@@ -103,6 +103,11 @@ class CpalTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return CPAL;
+    }
+
     public int getNumPalettesEntries() {
         return _numPalettesEntries;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
index 24139da22..77e57bf13 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
@@ -26,6 +26,11 @@ class CvtTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return cvt;
+    }
+
     public short[] getValues() {
         return values;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
index c10e007f0..e2c5dbced 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
@@ -8,8 +8,8 @@
 
 package jogamp.graph.font.typecast.ot.table;
 
-import java.io.IOException;
 import java.io.DataInput;
+import java.io.IOException;
 
 /**
  *
@@ -38,6 +38,11 @@ class DsigTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return DSIG;
+    }
+
     public String toString() {
         StringBuilder sb = new StringBuilder().append("DSIG\n");
         for (int i = 0; i < numSigs; i++) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
index 49e26ebbb..fb1cbb09c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
@@ -21,6 +21,11 @@ class FpgmTable extends Program implements Table {
         readInstructions(di, length);
     }
 
+    @Override
+    public int getType() {
+        return fpgm;
+    }
+
     public String toString() {
         return Disassembler.disassemble(getInstructions(), 0);
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
index c52e4b61c..c71a1ad5c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
@@ -31,6 +31,11 @@ public class GaspTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return gasp;
+    }
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("'gasp' Table - Grid-fitting And Scan-conversion Procedure\n---------------------------------------------------------");
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GdefTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GdefTable.java
index fdc4701f0..2fa69dd6b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GdefTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GdefTable.java
@@ -12,4 +12,9 @@ class GdefTable implements Table {
     protected GdefTable(DataInput di) throws IOException {
     }
 
+    @Override
+    public int getType() {
+        return GDEF;
+    }
+
 }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
index 5696750cc..035f0f314 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
@@ -107,6 +107,11 @@ public class GlyfTable implements Table {
 
     public int getSize() { return _descript.length; }
 
+    @Override
+    public int getType() {
+        return glyf;
+    }
+
     public GlyfDescript getDescription(final int i) {
         if (i < _descript.length) {
             return _descript[i];
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
index 1919a83f7..e7a882dcd 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
@@ -36,6 +36,11 @@ class GposTable implements Table {
         int lookupList = di.readInt();
     }
 
+    @Override
+    public int getType() {
+        return GPOS;
+    }
+
     public String toString() {
         return "GPOS";
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
index ca625a52f..b1ff4bcf3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
@@ -124,6 +124,11 @@ public class GsubTable implements Table, LookupSubtableFactory {
         return s;
     }
 
+    @Override
+    public int getType() {
+        return GSUB;
+    }
+
     public ScriptList getScriptList() {
         return _scriptList;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
index 34578a8de..6663bb12d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
@@ -88,6 +88,10 @@ public class HdmxTable implements Table {
     }
 
     @Override
+    public int getType() {
+        return hdmx;
+    }
+
     public String toString() {
         final StringBuilder sb = new StringBuilder();
         sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n");
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
index e5a5f5201..9d07e3260 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
@@ -54,31 +54,69 @@ import java.io.DataInput;
 import java.io.IOException;
 
 import jogamp.graph.font.typecast.ot.Fixed;
+import jogamp.graph.font.typecast.ot.LongDateTime;
 
 /**
+ * Font Header Table
+ * 
+ * This table gives global information about the font. The bounding box values
+ * ({@link #getXMin()}, {@link #getXMax()}, {@link #getYMin()},
+ * {@link #getYMax()}) should be computed using only glyphs that have contours.
+ * Glyphs with no contours should be ignored for the purposes of these
+ * calculations.
+ * 
  * @author <a href="mailto:david.schweinsberg@gmail.com">David Schweinsberg</a>
  */
 public class HeadTable implements Table {
-
-    private final int _versionNumber;
-    private final int _fontRevision;
-    private final int _checkSumAdjustment;
-    private final int _magicNumber;
-    private final short _flags;
-    private final int _unitsPerEm;
-    private final long _created;
-    private final long _modified;
-    private final short _xMin;
-    private final short _yMin;
-    private final short _xMax;
-    private final short _yMax;
-    private final short _macStyle;
-    private final short _lowestRecPPEM;
-    private final short _fontDirectionHint;
-    private final short _indexToLocFormat;
-    private final short _glyphDataFormat;
-
-    public HeadTable(final DataInput di) throws IOException {
+    
+    /**
+     * @see #getMagicNumber()
+     */
+    public static final int MAGIC = 0x5F0F3CF5;
+
+    /**
+     * @see #getGlyphDataFormat()
+     */
+    public static final short GLYPH_DATA_FORMAT = 0;
+
+    private int _versionNumber;
+    
+    private int _fontRevision;
+    
+    private int _checkSumAdjustment;
+    
+    private int _magicNumber = MAGIC;
+    
+    private short _flags;
+    
+    private short _unitsPerEm;
+    
+    private long _created;
+    
+    private long _modified;
+    
+    private short _xMin;
+    
+    private short _yMin;
+    
+    private short _xMax;
+    
+    private short _yMax;
+    
+    private short _macStyle;
+    
+    private short _lowestRecPPEM;
+    
+    private short _fontDirectionHint;
+    
+    private short _indexToLocFormat;
+    
+    private short _glyphDataFormat = GLYPH_DATA_FORMAT;
+
+    /**
+     * Creates a {@link HeadTable} from binary encoding.
+     */
+    public HeadTable(DataInput di) throws IOException {
         _versionNumber = di.readInt();
         _fontRevision = di.readInt();
         _checkSumAdjustment = di.readInt();
@@ -98,8 +136,17 @@ public class HeadTable implements Table {
         _glyphDataFormat = di.readShort();
     }
 
-    public int getCheckSumAdjustment() {
-        return _checkSumAdjustment;
+    @Override
+    public int getType() {
+        return head;
+    }
+
+    /**
+     * uint16     majorVersion     Major version number of the font header table — set to 1.
+     * uint16     minorVersion     Minor version number of the font header table — set to 0.
+     */
+    public int getVersionNumber() {
+        return _versionNumber;
     }
 
     public long getCreated() {
@@ -110,60 +157,251 @@ public class HeadTable implements Table {
         return _flags;
     }
 
-    public short getFontDirectionHint() {
-        return _fontDirectionHint;
-    }
-
+    /**
+     * Fixed Set by font manufacturer.
+     * 
+     * For historical reasons, the fontRevision value contained in this table is
+     * not used by Windows to determine the version of a font. Instead, Windows
+     * evaluates the version string (ID 5) in the 'name' table.
+     */
     public int getFontRevision(){
         return _fontRevision;
     }
 
-    public short getGlyphDataFormat() {
-        return _glyphDataFormat;
+    /**
+     * uint32
+     * 
+     * To compute: set it to 0, sum the entire font as uint32, then store
+     * 0xB1B0AFBA - sum.
+     * 
+     * If the font is used as a component in a font collection file, the value
+     * of this field will be invalidated by changes to the file structure and
+     * font table directory, and must be ignored.
+     */
+    public int getCheckSumAdjustment() {
+        return _checkSumAdjustment;
+    }
+    
+    /**
+     * uint32     Set to {@link #MAGIC}.
+     */
+    public int getMagicNumber() {
+        return _magicNumber;
     }
 
-    public short getIndexToLocFormat() {
-        return _indexToLocFormat;
+    /**
+     * uint16
+     * 
+     * Bit 0: Baseline for font at y=0;
+     * 
+     * Bit 1: Left sidebearing point at x=0 (relevant only for TrueType
+     * rasterizers) — see the note below regarding variable fonts;
+     * 
+     * Bit 2: Instructions may depend on point size;
+     * 
+     * Bit 3: Force ppem to integer values for all internal scaler math; may use
+     * fractional ppem sizes if this bit is clear;
+     * 
+     * Bit 4: Instructions may alter advance width (the advance widths might not
+     * scale linearly);
+     * 
+     * Bit 5: This bit is not used in OpenType, and should not be set in order
+     * to ensure compatible behavior on all platforms. If set, it may result in
+     * different behavior for vertical layout in some platforms. (See Apple’s
+     * specification for details regarding behavior in Apple platforms.)
+     * 
+     * Bits 6–10: These bits are not used in Opentype and should always be
+     * cleared. (See Apple’s specification for details regarding legacy used in
+     * Apple platforms.)
+     * 
+     * Bit 11: Font data is “lossless” as a result of having been subjected to
+     * optimizing transformation and/or compression (such as e.g. compression
+     * mechanisms defined by ISO/IEC 14496-18, MicroType Express, WOFF 2.0 or
+     * similar) where the original font functionality and features are retained
+     * but the binary compatibility between input and output font files is not
+     * guaranteed. As a result of the applied transform, the DSIG table may also
+     * be invalidated.
+     * 
+     * Bit 12: Font converted (produce compatible metrics)
+     * 
+     * Bit 13: Font optimized for ClearType™. Note, fonts that rely on embedded
+     * bitmaps (EBDT) for rendering should not be considered optimized for
+     * ClearType, and therefore should keep this bit cleared.
+     * 
+     * Bit 14: Last Resort font. If set, indicates that the glyphs encoded in
+     * the 'cmap' subtables are simply generic symbolic representations of code
+     * point ranges and don’t truly represent support for those code points. If
+     * unset, indicates that the glyphs encoded in the 'cmap' subtables
+     * represent proper support for those code points.
+     * 
+     * Bit 15: Reserved, set to 0
+     * 
+     * Note that, in a variable font with TrueType outlines, the left side
+     * bearing for each glyph must equal {@link #_xMin}, and bit 1 in the flags
+     * field must be set. 
+     * 
+     * Also, bit 5 must be cleared in all variable fonts. For
+     * general information on OpenType Font Variations, see the chapter,
+     * OpenType Font Variations Overview.
+     */
+    public short getFlags() {
+        return _flags;
     }
 
-    public short getLowestRecPPEM() {
-        return _lowestRecPPEM;
+    /**
+     * uint16
+     * 
+     * Set to a value from 16 to 16384. Any value in this range is valid. In
+     * fonts that have TrueType outlines, a power of 2 is recommended as this
+     * allows performance optimizations in some rasterizers.
+     */
+    public short getUnitsPerEm() {
+        return _unitsPerEm;
     }
 
-    public short getMacStyle() {
-        return _macStyle;
+    /**
+     * LONGDATETIME
+     * 
+     * Number of seconds since 12:00 midnight that started January 1st 1904 in
+     * GMT/UTC time zone. 64-bit integer
+     */
+    public long getCreated() {
+        return _created;
     }
 
+    /**
+     * LONGDATETIME
+     * 
+     * Number of seconds since 12:00 midnight that started January 1st 1904 in
+     * GMT/UTC time zone. 64-bit integer
+     */
     public long getModified() {
         return _modified;
     }
 
-    public int getType() {
-        return head;
-    }
-
-    public int getUnitsPerEm() {
-        return _unitsPerEm;
+    /**
+     * int16     
+     * 
+     * For all glyph bounding boxes.
+     */
+    public short getXMin() {
+        return _xMin;
     }
 
-    public int getVersionNumber() {
-        return _versionNumber;
+    /**
+     * int16     
+     * 
+     * For all glyph bounding boxes.
+     */
+    public short getYMin() {
+        return _yMin;
     }
 
+    /**
+     * int16     
+     * 
+     * For all glyph bounding boxes.
+     */
     public short getXMax() {
         return _xMax;
     }
 
-    public short getXMin() {
-        return _xMin;
-    }
-
+    /**
+     * int16     
+     * 
+     * For all glyph bounding boxes.
+     */
     public short getYMax() {
         return _yMax;
     }
 
-    public short getYMin() {
-        return _yMin;
+    /**
+     * uint16
+     * 
+     * Bit 0: Bold (if set to 1);
+     * 
+     * Bit 1: Italic (if set to 1)
+     * 
+     * Bit 2: Underline (if set to 1)
+     * 
+     * Bit 3: Outline (if set to 1)
+     * 
+     * Bit 4: Shadow (if set to 1)
+     * 
+     * Bit 5: Condensed (if set to 1)
+     * 
+     * Bit 6: Extended (if set to 1)
+     * 
+     * Bits 7–15: Reserved (set to 0).
+     * 
+     * Note that the macStyle bits must agree with the OS/2 table fsSelection
+     * bits. The fsSelection bits are used over the macStyle bits in Microsoft
+     * Windows. The PANOSE values and 'post' table values are ignored for
+     * determining bold or italic fonts.
+     */
+    public short getMacStyle() {
+        return _macStyle;
+    }
+
+    /**
+     * uint16     
+     * 
+     * Smallest readable size in pixels.
+     */
+    public short getLowestRecPPEM() {
+        return _lowestRecPPEM;
+    }
+
+    /**
+     * int16
+     * 
+     * Deprecated (Set to 2).
+     * 
+     * 0: Fully mixed directional glyphs;
+     * 
+     * 1: Only strongly left to right;
+     * 
+     * 2: Like 1 but also contains neutrals;
+     * 
+     * -1: Only strongly right to left;
+     * 
+     * -2: Like -1 but also contains neutrals.
+     * 
+     * (A neutral character has no inherent directionality; it is not a
+     * character with zero (0) width. Spaces and punctuation are examples of
+     * neutral characters. Non-neutral characters are those with inherent
+     * directionality. For example, Roman letters (left-to-right) and Arabic
+     * letters (right-to-left) have directionality. In a “normal” Roman font
+     * where spaces and punctuation are present, the font direction hints should
+     * be set to two (2).)
+     */
+    public short getFontDirectionHint() {
+        return _fontDirectionHint;
+    }
+
+    /**
+     * int16
+     * 
+     * 0 for short offsets (Offset16), 1 for long (Offset32).
+     */
+    public short getIndexToLocFormat() {
+        return _indexToLocFormat;
+    }
+
+    /**
+     * Whether short offsets (Offset16) are used.
+     */
+    public boolean useShortEntries() {
+        return getIndexToLocFormat() == 0;
+    }
+
+    /**
+     * int16
+     * 
+     * {@link #GLYPH_DATA_FORMAT} for current format.
+     */
+    public short getGlyphDataFormat() {
+        return _glyphDataFormat;
     }
 
     @Override
@@ -175,8 +413,8 @@ public class HeadTable implements Table {
                 "\n  magicNumber:         0x" + Integer.toHexString(_magicNumber).toUpperCase() +
                 "\n  flags:               0x" + Integer.toHexString(_flags).toUpperCase() +
                 "\n  unitsPerEm:          " + _unitsPerEm +
-                "\n  created:             " + _created +
-                "\n  modified:            " + _modified +
+                "\n  created:             " + LongDateTime.toDate(_created) +
+                "\n  modified:            " + LongDateTime.toDate(_modified) +
                 "\n  xMin:                " + _xMin +
                 "\n  yMin:                " + _yMin +
                 "\n  xMax:                " + _xMax +
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
index 333b36f56..97f201104 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
@@ -48,6 +48,11 @@ public class HheaTable implements Table {
         numberOfHMetrics = di.readUnsignedShort();
     }
 
+    @Override
+    public int getType() {
+        return hhea;
+    }
+
     public short getAdvanceWidthMax() {
         return advanceWidthMax;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
index 090eca65c..03633e3e5 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
@@ -83,6 +83,11 @@ public class HmtxTable implements Table {
         _length = length;
     }
 
+    @Override
+    public int getType() {
+        return hmtx;
+    }
+
     public int getAdvanceWidth(int i) {
         if (_hMetrics == null) {
             return 0;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
index 4d9abe241..6b917a063 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
@@ -37,6 +37,11 @@ public class KernTable implements Table {
         table0 = _table0;
     }
 
+    @Override
+    public int getType() {
+        return kern;
+    }
+
     public int getSubtableCount() {
         return nTables;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
index 0d0c115b8..785d99036 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
@@ -26,7 +26,8 @@ public class LocaTable implements Table {
             HeadTable head,
             MaxpTable maxp) throws IOException {
         _offsets = new int[maxp.getNumGlyphs() + 1];
-        boolean shortEntries = head.getIndexToLocFormat() == 0;
+        boolean shortEntries = head.useShortEntries();
+        // FIXME boolean shortEntries = head.getIndexToLocFormat() == 0;
         if (shortEntries) {
             _factor = 2;
             for (int i = 0; i <= maxp.getNumGlyphs(); i++) {
@@ -51,6 +52,11 @@ public class LocaTable implements Table {
         }
         _length = length;
     }
+    
+    @Override
+    public int getType() {
+        return loca;
+    }
 
     public int getOffset(int i) {
         if (_offsets == null) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
index 588e5d7e6..75afacec4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
@@ -31,6 +31,11 @@ class LtshTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return LTSH;
+    }
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------")
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
index 19521726e..48a9aaa66 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
@@ -57,6 +57,11 @@ public class MaxpTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return maxp;
+    }
+
     public int getVersionNumber() {
         return versionNumber;
     }
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 2aca34416..970427f9f 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
@@ -50,9 +50,9 @@
 
 package jogamp.graph.font.typecast.ot.table;
 
+import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
 /**
@@ -93,6 +93,11 @@ public class NameTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return name;
+    }
+
     public short getNumberOfNameRecords() {
         return _numberOfNameRecords;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
index f88a78d24..c082a7e05 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
@@ -142,6 +142,11 @@ public class Os2Table implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return OS_2;
+    }
+
     public int getVersion() {
         return _version;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
index 47c633d26..c3c6ab83d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
@@ -58,6 +58,11 @@ class PcltTable implements Table {
         reserved = di.readByte();
     }
 
+    @Override
+    public int getType() {
+        return PCLT;
+    }
+
     public String toString() {
         return "'PCLT' Table - Printer Command Language Table\n---------------------------------------------" +
                 "\n        version:             0x" + Integer.toHexString(version).toUpperCase() +
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
index 3226b9d0a..08a4cd91f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
@@ -328,6 +328,11 @@ public class PostTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return post;
+    }
+
     public int getVersion() {
         return version;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
index 1bd38bd85..03c5743c6 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
@@ -21,6 +21,11 @@ class PrepTable extends Program implements Table {
         readInstructions(di, length);
     }
 
+    @Override
+    public int getType() {
+        return prep;
+    }
+
     public String toString() {
         return Disassembler.disassemble(getInstructions(), 0);
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SbixTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SbixTable.java
index 687bd4eb4..9ec330cc8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SbixTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SbixTable.java
@@ -144,6 +144,11 @@ public class SbixTable implements Table {
                 buf.length - offset);
     }
     
+    @Override
+    public int getType() {
+        return sbix;
+    }
+
     public Strike[] getStrikes() {
         return _strikes;
     }
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 cac75ebc9..30fab2b6f 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
@@ -61,4 +61,8 @@ public interface Table {
     static final int vhea = 0x76686561; // Vertical Metrics header
     static final int vmtx = 0x766d7478; // Vertical Metrics
 
+    /**
+     * The type code of this {@link Table}.
+     */
+    int getType();
 }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
index ac1b8ecf9..a38035e53 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
@@ -143,6 +143,11 @@ public class VdmxTable implements Table {
         }
     }
     
+    @Override
+    public int getType() {
+        return VDMX;
+    }
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n")
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
index 57c4aa914..d7685be74 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
@@ -59,6 +59,11 @@ public class VheaTable implements Table {
         _numberOfLongVerMetrics = di.readUnsignedShort();
     }
 
+    @Override
+    public int getType() {
+        return vhea;
+    }
+
     public short getAdvanceHeightMax() {
         return _advanceHeightMax;
     }
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
index 6ceaa73ad..6e6397d90 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
@@ -49,6 +49,11 @@ class VmtxTable implements Table {
         }
     }
 
+    @Override
+    public int getType() {
+        return vmtx;
+    }
+
     private int getAdvanceHeight(int i) {
         if (_vMetrics == null) {
             return 0;
-- 
cgit v1.2.3