diff options
author | Sven Göthel <[email protected]> | 2024-02-04 07:40:26 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-04 07:40:26 +0100 |
commit | 37664c391b4d0bb4f0718726c543726ee30a13f8 (patch) | |
tree | 96b06c723f08f9f7aa0ef067dc532c4f26889927 | |
parent | 5770c2465e171dd191fbc09003476f5ad4c33e53 (diff) |
Graph Font: Pull up static function
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/font/Font.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 068363ce4..6f5fe6c03 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -340,6 +340,22 @@ public interface Font { // return new String(Character.toChars(codepoint)); } + /** + * Returns {@link Font} with best coverage for given text while favoring {@code a}. See {@link #getDefinedCount(CharSequence)}. + * <pre> + * return a.getDefinedCount(text) >= b.getDefinedCount(text) ? a : b; + * </pre> + */ + public static Font getBestCoverage(final Font a, final Font b, final CharSequence s) { + if( null != a && null != b ) { + return a.getDefinedCount(s) >= b.getDefinedCount(s) ? a : b; + } else if( null != a ) { + return a; + } else { + return b; + } + } + String getName(final int nameIndex); /** Shall return the family and subfamily name, separated a dash. @@ -387,22 +403,6 @@ public interface Font { /** Returns the number of defined {@link Glyph}s (coverage), i.e. not {@link Glyph#isUndefined()}, of given text. */ int getDefinedCount(final CharSequence text); - /** - * Returns {@link Font} with best coverage for given text while favoring {@code a}. See {@link #getDefinedCount(CharSequence)}. - * <pre> - * return a.getDefinedCount(text) >= b.getDefinedCount(text) ? a : b; - * </pre> - */ - public static Font getBestCoverage(final Font a, final Font b, final CharSequence text) { - if( null != a && null != b ) { - return a.getDefinedCount(text) >= b.getDefinedCount(text) ? a : b; - } else if( null != a ) { - return a; - } else { - return b; - } - } - /** Returns the {@link Glyph} (unicode) `codepoint` symbol mapped to given {@link Glyph} `name`. */ char getGlyphCodepoint(final String name); |