aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-02-12 00:16:25 +0100
committerSven Gothel <[email protected]>2023-02-12 00:23:07 +0100
commit139d89bb7f7dd86d862608f39e90b34803a48753 (patch)
treeb943cb13afa6889945214485d80b3bb74b58b04c
parentf43c13de9e4dd2e2ba92da23191730bdf51b61c5 (diff)
TTFont: Handle null result of _glyf.getDescription(i)
-rw-r--r--src/main/java/net/java/dev/typecast/ot/TTFont.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/net/java/dev/typecast/ot/TTFont.java b/src/main/java/net/java/dev/typecast/ot/TTFont.java
index 4505f1b..c8ac6bd 100644
--- a/src/main/java/net/java/dev/typecast/ot/TTFont.java
+++ b/src/main/java/net/java/dev/typecast/ot/TTFont.java
@@ -164,11 +164,17 @@ public class TTFont extends OTFont {
return _vdmx;
}
- public Glyph getGlyph(int i) {
- return new TTGlyph(
- _glyf.getDescription(i),
- getHmtxTable().getLeftSideBearing(i),
- getHmtxTable().getAdvanceWidth(i));
+ @Override
+ public Glyph getGlyph(final int i) {
+ final GlyfDescript glyfDescr = _glyf.getDescription(i);
+ if( null != glyfDescr ) {
+ return new TTGlyph(
+ glyfDescr,
+ getHmtxTable().getLeftSideBearing(i),
+ getHmtxTable().getAdvanceWidth(i));
+ } else {
+ return null;
+ }
}
}