From 4ba099b97df41be220c4b2816c728e6b8cc1b037 Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Sat, 3 Feb 2024 01:14:10 +0100 Subject: Graph/GraphUI: Move getDefault*() to FontFactory and add {get,set}FallbackFont() + Font.getBestCoverage(..); Use fallback-font in MediaButton in case chosen font doesn't match (foreign languages, e.g. 'zho' Chinese .. ) --- src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/jogl/classes/jogamp/graph/font') diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index c60629582..0a251a378 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -223,6 +223,17 @@ class TypecastFont implements Font { @Override public int getGlyphCount() { return font.getGlyphCount(); } + @Override + public int getDefinedCount(final CharSequence text) { + int res = 0; + for(int i=text.length()-1; i>=0; --i) { + if( !getGlyph(text.charAt(i)).isUndefined() ) { + ++res; + } + } + return res; + } + @Override public char getGlyphCodepoint(final String name) { final SymAndID value = nameToGlyph.get(name); -- cgit v1.2.3