From e4bddd1682233257a20eb73e22b068d5d4694860 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 14 Apr 2023 17:42:57 +0200 Subject: Typecast: Expose (new) getGlyphCount(): GlyfTable.getSize() -> (OTFont,Font).getGlyphCount() --- src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 3 +++ src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java | 4 ++++ src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java | 3 +++ src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java | 4 +++- 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/jogamp/graph') diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 26952ce9a..d981e09aa 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -188,6 +188,9 @@ class TypecastFont implements Font { return font.getPostTable(); } + @Override + public int getGlyphCount() { return font.getGlyphCount(); } + @Override public Glyph getGlyph(final int glyph_id) { TypecastGlyph result = (TypecastGlyph) idToGlyph.get(glyph_id); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 9ddd080aa..ca45c21aa 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -152,6 +152,10 @@ public abstract class OTFont { return _maxp.getNumGlyphs(); } + /** Return number of {@link Glyph} IDs available, i.e. retrievable via {@link #getGlyph(int)} [0..count). */ + public abstract int getGlyphCount(); + + /** Return the {@link Glyph} using given ID, see {@link #getGlyphCount()}. */ public abstract Glyph getGlyph(int i); int seekTable( diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java index e7f3f5e35..4cae9bc19 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/TTFont.java @@ -164,6 +164,9 @@ public class TTFont extends OTFont { return _vdmx; } + @Override + public int getGlyphCount() { return _glyf.getSize(); } + @Override public Glyph getGlyph(final int i) { final GlyfDescript glyfDescr = _glyf.getDescription(i); 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 d35ce9baf..5696750cc 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 @@ -105,7 +105,9 @@ public class GlyfTable implements Table { } } - public GlyfDescript getDescription(int i) { + public int getSize() { return _descript.length; } + + public GlyfDescript getDescription(final int i) { if (i < _descript.length) { return _descript[i]; } else { -- cgit v1.2.3