From 920e529516bb264f04138ed1caca80d4925e3773 Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Mon, 28 Aug 2023 22:57:53 +0200 Subject: Graph Font + Glyph: More robust detetection and API definition of non-contour/whitespace Glyphs (detect and allow to skip 'em) We also drop shapes for both, but for id 0 (unknown). --- src/jogl/classes/com/jogamp/graph/font/Font.java | 37 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/font/Font.java') diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 314040adf..ef1179153 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -175,12 +175,43 @@ public interface Font { /** Return the glyph's name, source from `post` table */ String getName(); - /** Return true if the underlying {@link #getShape()} is a whitespace, otherwise false. */ - boolean isWhiteSpace(); + /** + * Return true if the glyph is a whitespace, otherwise false. + * <p> + * A whitespace glyph has no {@link #getShape()}, but a valid {@link #getBounds()} and {@link #getAdvance()}. + * </p> + * Being a whitespace glyph excludes {@link #isUndefined()}. + * @see #isUndefined() + * @see #isNonContour() + */ + boolean isWhitespace(); - /** Return true if the Glyph denotes an undefined {@link #getID()} symbol, i.e. {@link #getName()} == `.notdef`. */ + /** + * Return true if the Glyph denotes an undefined {@link #getID()} symbol as follows + * <ul> + * <li>it's glyph index is {@link #ID_UNKNOWN}, i.e. {@code 0x00}</li> + * <li>has the {@link #getName() name} `.notdef`, `NULL`, `null` or `.null`</li> + * <li>has no original underlying shape</li> + * </ul> + * <p> + * An undefined glyph has no {@link #getShape()} if glyph index is not {@link #ID_UNKNOWN}. + * </p> + * <p> + * An undefined glyph has a default {@link #getBounds()} and {@link #getAdvance()}. + * </p> + * Being an undefined shape excludes {@link #isWhitespace()}. + * @see #isWhitespace() + * @see #isNonContour() + */ boolean isUndefined(); + /** + * Returns true if {@link #isWhitespace()} or {@link #isUndefined()}. + * @see #isWhitespace() + * @see #isUndefined() + */ + boolean isNonContour(); + /** * Return the AABBox in font-units, borrowing internal instance. */ -- cgit v1.2.3