aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-02-10 14:03:48 +0100
committerSven Gothel <[email protected]>2023-02-10 14:03:48 +0100
commitdc1319bb52558b52a68600f4b1fbe9e290b5c9bd (patch)
tree43bf2949fde52353babce71b26c64d878047285f /src
parentda08083d2155a439a7ccf2460fca10aca6e59d92 (diff)
Typecast: OTGlyph: Maintain the glyphID, add toString()
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
index 8ed450326..6ed5f8f3a 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
@@ -67,6 +67,7 @@ import com.jogamp.opengl.math.geom.AABBox;
*/
public final class OTGlyph {
+ private final int _glyphIndex;
private final short _leftSideBearing;
private final int _advanceWidth;
private Point[] _points;
@@ -76,10 +77,11 @@ public final class OTGlyph {
* Construct a Glyph from a TrueType outline described by
* a GlyphDescription.
* @param cs The Charstring describing the glyph.
- * @param lsb The Left Side Bearing.
- * @param advance The advance width.
+ * @param lsb The Left Side Bearing (hmtx).
+ * @param advance The advance width (hmtx).
*/
public OTGlyph(final GlyphDescription gd, final short lsb, final int advance) {
+ _glyphIndex = gd.getGlyphIndex();
_leftSideBearing = lsb;
_advanceWidth = advance;
describe(gd);
@@ -91,7 +93,8 @@ public final class OTGlyph {
* @param lsb The Left Side Bearing.
* @param advance The advance width.
*/
- public OTGlyph(final Charstring cs, final short lsb, final int advance) {
+ public OTGlyph(final int glyphID, final Charstring cs, final short lsb, final int advance) {
+ _glyphIndex = glyphID;
_leftSideBearing = lsb;
_advanceWidth = advance;
if (cs instanceof CharstringType2) {
@@ -102,6 +105,10 @@ public final class OTGlyph {
}
}
+ public int getGlyphIndex() {
+ return _glyphIndex;
+ }
+
public final void clearPointData() {
_points = null;
}
@@ -110,10 +117,12 @@ public final class OTGlyph {
return _bbox;
}
+ /** hmtx value */
public final int getAdvanceWidth() {
return _advanceWidth;
}
+ /** hmtx value */
public final short getLeftSideBearing() {
return _leftSideBearing;
}
@@ -164,4 +173,13 @@ public final class OTGlyph {
_bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
}
+
+ @Override
+ public String toString() {
+ return new StringBuilder()
+ .append("OTGlyph id ").append(_glyphIndex).append(", points ").append(_points.length)
+ .append(", advance ").append(getAdvanceWidth())
+ .append(", ").append(_bbox)
+ .toString();
+ }
}