diff options
author | Sven Gothel <[email protected]> | 2023-02-12 07:17:16 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-12 07:17:16 +0100 |
commit | 93c51380f34c3eb203f46df52fed49a8a967510e (patch) | |
tree | 52d8745dffc4f7581efdc118f7ec0792b7b75315 /src/jogl/classes/com/jogamp/graph/font | |
parent | 87060fe41b559418ea7b383e162d3d80fb515e0b (diff) |
Graph font/typecast: Adopt to our Typecast updates (see below); Fix kerning; Use TestTextRendererNEWT01 to produce validation snaps
- Move kerning handling from Font to Font.Glyph using binary-search for right-glyph-id on kerning subset from this instance (left)
- TextRegionUtil: Kerning must be added before translation as it applies before the current right-glyph.
- TestTextRendererNEWT01 produces validation snapshots against LibreOffice print-preview snapshots
- GPUTextRendererListenerBase01 added another text for kerning validation, show more font-size details (pt, px, mm)
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/font')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/font/Font.java | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 9f25b5481..5c63227b3 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -144,6 +144,8 @@ public interface Font { Font getFont(); char getSymbol(); + + /** Return this glyph's ID */ int getID(); /** @@ -188,20 +190,49 @@ public interface Font { */ float getAdvance(final float pixelSize); + /** True if kerning values are horizontal, otherwise vertical */ + boolean isKerningHorizontal(); + /** True if kerning values are perpendicular to text flow, otherwise along with flow */ + boolean isKerningCrossstream(); + + /** Return the number of kerning values stored for this glyph, associated to a right hand glyph. */ + int getKerningPairCount(); + + /** + * Returns the optional kerning inter-glyph distance within words between this glyph and the given right glyph_id in font-units to be divided by unitsPerEM + * + * @param right_glyphid right glyph code id + * @return font-units to be divided by unitsPerEM + */ + int getKerningFU(final int right_glyphid); + + /** + * Returns the optional kerning inter-glyph distance within words between this glyph and the given right glyph_id in fractional font em-size [0..1]. + * + * @param right_glyphid right glyph code id + * @return fractional font em-size distance [0..1] + */ + float getKerning(final int right_glyphid); + OutlineShape getShape(); @Override int hashCode(); + + @Override + String toString(); + + /** Return all glyph details as string. */ + String fullString(); } String getName(final int nameIndex); - StringBuilder getName(final StringBuilder string, final int nameIndex); /** Shall return the family and subfamily name, separated a dash. * <p>{@link #getName(StringBuilder, int)} w/ {@link #NAME_FAMILY} and {@link #NAME_SUBFAMILY}</p> * <p>Example: "{@code Ubuntu-Regular}"</p> */ - StringBuilder getFullFamilyName(final StringBuilder buffer); + String getFullFamilyName(); StringBuilder getAllNames(final StringBuilder string, final String separator); @@ -225,27 +256,12 @@ public interface Font { */ int getAdvanceWidthFU(final int glyphID); - /** - * Returns the optional kerning inter-glyph distance within words in fractional font em-size [0..1]. - * - * @param left_glyphid left glyph code id - * @param right_glyphid right glyph code id - * @return fractional font em-size distance [0..1] - */ - float getKerning(final int left_glyphid, final int right_glyphid); - - /** - * Returns the optional kerning inter-glyph distance within words in fractional font-units to be divided by unitsPerEM - * - * @param left_glyphid left glyph code id - * @param right_glyphid right glyph code id - * @return font-units to be divided by unitsPerEM - */ - int getKerningFU(final int left_glyphid, final int right_glyphid); - Metrics getMetrics(); + int getGlyphID(final char symbol); + Glyph getGlyph(final char symbol); + int getNumGlyphs(); /** |