diff options
author | Sven Gothel <[email protected]> | 2023-04-14 17:42:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-14 17:42:57 +0200 |
commit | e4bddd1682233257a20eb73e22b068d5d4694860 (patch) | |
tree | b441834342426601c966d1f7dc8cfd44202b4674 /src/jogl/classes | |
parent | be865f7fdb672ce41110231ba71903671942268b (diff) |
Typecast: Expose (new) getGlyphCount(): GlyfTable.getSize() -> (OTFont,Font).getGlyphCount()
Diffstat (limited to 'src/jogl/classes')
5 files changed, 18 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 3d7e9f6a1..4829cb0fd 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -319,8 +319,13 @@ public interface Font { Metrics getMetrics(); + /** Return the {@link Glyph} ID mapped to given `symbol`, usually UTF16 unicode. Returned ID can be used to retrieve the {@link Glyph} via {@link #getGlyph(int)}. */ int getGlyphID(final char symbol); + /** Return number of {@link Glyph} IDs available, i.e. retrievable via {@link #getGlyph(int)} [0..count). */ + int getGlyphCount(); + + /** Return the {@link Glyph} using given ID, see {@link #getGlyphCount()}. */ Glyph getGlyph(final int glyph_id); int getNumGlyphs(); 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 @@ -189,6 +189,9 @@ class TypecastFont implements Font { } @Override + public int getGlyphCount() { return font.getGlyphCount(); } + + @Override public Glyph getGlyph(final int glyph_id) { TypecastGlyph result = (TypecastGlyph) idToGlyph.get(glyph_id); if (null == result) { 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 @@ -165,6 +165,9 @@ public class TTFont extends OTFont { } @Override + public int getGlyphCount() { return _glyf.getSize(); } + + @Override public Glyph getGlyph(final int i) { final GlyfDescript glyfDescr = _glyf.getDescription(i); if( null != glyfDescr ) { 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 { |