aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-02-12 00:18:31 +0100
committerSven Gothel <[email protected]>2023-02-12 00:18:31 +0100
commit626d97d5a9f971c1a3d85440a7182bfc46569b72 (patch)
tree01162d6119074eb5315e058a294de1b6cdca0bac
parentce9a9d44d9143d153dc9d02568e4c8d3761f9c7b (diff)
Fix: HeadTable's unitPerEm is uint16 not int16, hence use int type and read accordingly.
-rw-r--r--src/main/java/net/java/dev/typecast/exchange/SVGExporter.java2
-rw-r--r--src/main/java/net/java/dev/typecast/ot/table/HeadTable.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/net/java/dev/typecast/exchange/SVGExporter.java b/src/main/java/net/java/dev/typecast/exchange/SVGExporter.java
index 1a8fbc3..fcaca25 100644
--- a/src/main/java/net/java/dev/typecast/exchange/SVGExporter.java
+++ b/src/main/java/net/java/dev/typecast/exchange/SVGExporter.java
@@ -199,7 +199,7 @@ public class SVGExporter
private static String getSVGFontFaceElement(OTFont font) {
StringBuilder sb = new StringBuilder();
String fontFamily = font.getNameTable().getRecordString(ID.nameFontFamilyName);
- short unitsPerEm = font.getHeadTable().getUnitsPerEm();
+ int unitsPerEm = font.getHeadTable().getUnitsPerEm();
String panose = font.getOS2Table().getPanose().toString();
short ascent = font.getHheaTable().getAscender();
short descent = font.getHheaTable().getDescender();
diff --git a/src/main/java/net/java/dev/typecast/ot/table/HeadTable.java b/src/main/java/net/java/dev/typecast/ot/table/HeadTable.java
index 88e3ba6..3269a6e 100644
--- a/src/main/java/net/java/dev/typecast/ot/table/HeadTable.java
+++ b/src/main/java/net/java/dev/typecast/ot/table/HeadTable.java
@@ -60,12 +60,12 @@ import net.java.dev.typecast.ot.Fixed;
*/
public class HeadTable implements Table {
- private short _unitsPerEm;
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;
@@ -84,7 +84,7 @@ public class HeadTable implements Table {
_checkSumAdjustment = di.readInt();
_magicNumber = di.readInt();
_flags = di.readShort();
- _unitsPerEm = di.readShort();
+ _unitsPerEm = di.readUnsignedShort();
_created = di.readLong();
_modified = di.readLong();
_xMin = di.readShort();
@@ -142,7 +142,7 @@ public class HeadTable implements Table {
return head;
}
- public short getUnitsPerEm() {
+ public int getUnitsPerEm() {
return _unitsPerEm;
}