diff options
author | Sven Gothel <[email protected]> | 2023-09-24 16:50:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-24 16:50:49 +0200 |
commit | a8de1673ca83475227fcc914fd94a9a0be1cba79 (patch) | |
tree | f180bafeb037fd66eed565236a054322fe5e229e /src/test | |
parent | 0c8700589abffe13e42f18d3c755541268d44a34 (diff) |
Bug 1462 - Graph Font: Add name + codepoint to ID and Glyph mapping plus traversing through all Glyphs
See UISceneDemo03
new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("pause")+" ", buttonWidth, buttonHeight); // pause
Unicode codepoint symbol is also contained in FontGlyph
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java | 7 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/TestFontsNEWT00.java | 13 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java index e5a5ad24e..6c3bd692a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java @@ -138,13 +138,12 @@ public class FontViewListener01 implements GLEventListener { scene.addShape(grid); for(int idx=0; idx<Character.MAX_VALUE && grid.getShapeCount() < cellCount ; ++idx) { - final char symbol = (char)(startCharSymbol+idx); - final int glyphID = font.getGlyphID(symbol); - final Font.Glyph glyph = font.getGlyph(glyphID); + final char codepoint = (char)(startCharSymbol+idx); + final Font.Glyph glyph = font.getGlyph( codepoint ); if( glyph.isNonContour() ) { continue; } - final GlyphShape glyphShape = new GlyphShape(renderModes, symbol, glyph, 0, 0); + final GlyphShape glyphShape = new GlyphShape(renderModes, glyph, 0, 0); glyphShape.setColor(0.1f, 0.1f, 0.1f, 1); glyphShape.setDragAndResizeable(false); glyphShape.onClicked( new Shape.Listener() { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestFontsNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestFontsNEWT00.java index 6516b2b1b..6050de8b5 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestFontsNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestFontsNEWT00.java @@ -81,20 +81,19 @@ public class TestFontsNEWT00 extends UITestCase { } } void testFontGlyph01(final Font font, final char c, final float pixelSize) { - final int glyphID = font.getGlyphID(c); - final int s0 = font.getAdvanceWidthFU(glyphID); - final Font.Glyph glyph = font.getGlyph(glyphID); - final int s1 = glyph.getAdvanceFU(); + final Font.Glyph glyph = font.getGlyph( c ); + final int s0 = font.getAdvanceWidthFU( glyph.getID() ); + final int s1 = glyph.getAdvanceWidthFU(); final int unitsPerEM = font.getMetrics().getUnitsPerEM(); - final float s0_em = font.getAdvanceWidth(glyphID); - final float s1_em = glyph.getAdvance(); + final float s0_em = font.getAdvanceWidth( glyph.getID() ); + final float s1_em = glyph.getAdvanceWidth(); final float s0_px = s0_em * pixelSize; final float s1_px = s1_em * pixelSize; - System.err.println(" Char '"+c+"', id "+glyphID+", font-px "+pixelSize+", unitsPerEM "+unitsPerEM+":"); + System.err.println(" Char '"+c+"', id "+glyph.getID()+", font-px "+pixelSize+", unitsPerEM "+unitsPerEM+":"); System.err.println(" "+glyph); System.err.println(" Advance"); System.err.println(" funits "+s0+", "+s1); |