aboutsummaryrefslogtreecommitdiffstats
path: root/src/demos/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/com/jogamp')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java38
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java14
6 files changed, 31 insertions, 33 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
index d2c314764..99d491ae8 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -37,6 +37,7 @@ import com.jogamp.common.util.IOUtil;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.font.Font;
+import com.jogamp.graph.font.Font.Glyph;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.font.FontScale;
import com.jogamp.graph.ui.Group;
@@ -127,6 +128,7 @@ public class FontView01 {
final Font fontStatus = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf", FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(), true);
final Font fontInfo = FontFactory.get(FontFactory.UBUNTU).getDefault();
System.err.println("Status Font "+fontStatus.getFullFamilyName());
+ System.err.println("Info Font "+fontInfo.getFullFamilyName());
final GLProfile reqGLP = GLProfile.get(options.glProfileName);
System.err.println("GLProfile: "+reqGLP);
@@ -187,11 +189,11 @@ public class FontView01 {
final Shape.MouseGestureListener glyphMouseListener;
{
final Group glyphShapeBox = new Group( new BoxLayout( 1f, 1f, Alignment.FillCenter, new Margin(0.025f) ) );
- glyphShapeBox.addShape( new GlyphShape(options.renderModes, 'A', font.getGlyph( font.getGlyphID('A')), 0, 0) );
+ glyphShapeBox.addShape( new GlyphShape(options.renderModes, font.getGlyph( 'A' ), 0, 0) );
final Group glyphInfoBox = new Group( new BoxLayout( 1f, 1f, Alignment.FillCenter, new Margin(0.05f, 0.025f, 0.05f, 0.025f) ) );
final Label glyphInfo = new Label(options.renderModes, fontStatus, "Nothing there yet");
- setGlyphInfo(fontStatus, glyphInfo, 'A', font.getGlyph(font.getGlyphID('A')));
+ setGlyphInfo(fontStatus, glyphInfo, font.getGlyph( 'A' ));
glyphInfo.setColor(0.1f, 0.1f, 0.1f, 1.0f);
glyphInfoBox.addShape(glyphInfo);
@@ -220,7 +222,7 @@ public class FontView01 {
if( 1 == glyphShapeBox.getShapeCount() ) {
final GlyphShape old = (GlyphShape) glyphShapeBox.getShapes().get(0);
if( null != old ) {
- if( !doScreenshot && old.getSymbol() == g0.getSymbol() ) {
+ if( !doScreenshot && old.getGlyph().getCodepoint() == g0.getGlyph().getCodepoint() ) {
// System.err.println("GlyphShape Same: "+old);
return true; // abort - no change
}
@@ -238,7 +240,7 @@ public class FontView01 {
final GlyphShape gs = new GlyphShape( g0 ); // copy GlyphShape
gs.setColor(0, 0, 0, 1);
glyphShapeBox.addShape( gs );
- setGlyphInfo(fontStatus, glyphInfo, gs.getSymbol(), gs.getGlyph());
+ setGlyphInfo(fontStatus, glyphInfo, gs.getGlyph());
glyphInfo.validate(d.getGL().getGL2ES2()); // avoid group re-validate
// System.err.println("GlyphInfo "+glyphInfo.getBounds());
if( doScreenshot ) {
@@ -436,14 +438,12 @@ public class FontView01 {
public int scanContourGlyphs(final Font font) {
contourChars.clear();
maxNameLen = 1;
- for(int i=0; i <= Character.MAX_VALUE; ++i) {
- final int glyphID = font.getGlyphID((char)i);
- final Font.Glyph fg = font.getGlyph(glyphID);
+ font.forAllGlyphs((final Glyph fg) -> {
if( !fg.isNonContour() ) {
- contourChars.add((char)i);
+ contourChars.add( fg.getCodepoint() );
maxNameLen = Math.max(maxNameLen, fg.getName().length());
}
- }
+ });
return contourChars.size();
}
@@ -483,15 +483,13 @@ public class FontView01 {
static void addGlyphs(final GLProfile glp, final Font font, final Group sink,
final GridDim gridDim, final boolean showUnderline, final boolean showLabel,
final Font fontStatus, final Font fontInfo, final Shape.MouseGestureListener glyphMouseListener) {
- int glyphID = -1; // startGlyphID;
gridDim.nextLine = Math.min(gridDim.start + gridDim.columns, gridDim.contourChars.size()-1);
gridDim.nextPage = Math.min(gridDim.start + gridDim.elemCount, gridDim.contourChars.size()-1);
for(int idx = gridDim.start; idx < gridDim.nextPage; ++idx) {
- final char charID = gridDim.contourChars.get(idx);
- glyphID = font.getGlyphID( charID );
- final Font.Glyph fg = font.getGlyph(glyphID);
+ final char codepoint = gridDim.contourChars.get(idx);
+ final Font.Glyph fg = font.getGlyph(codepoint);
- final GlyphShape g = new GlyphShape(options.renderModes, charID, fg, 0, 0);
+ final GlyphShape g = new GlyphShape(options.renderModes, fg, 0, 0);
g.setColor(0.1f, 0.1f, 0.1f, 1);
g.setDragAndResizeable(false);
@@ -508,7 +506,7 @@ public class FontView01 {
c1.addShape(g);
c1.addMouseListener(glyphMouseListener);
if( 0 == ( idx - gridDim.start ) % gridDim.columns ) {
- addLabel(sink, fontStatus, String.format("%04x", (int)charID));
+ addLabel(sink, fontStatus, String.format("%04x", (int)codepoint));
}
if( showLabel ) {
final Group c2 = new Group( new GridLayout( 1, 0, 0, Alignment.None) ); // Alignment(Alignment.Bit.CenterHoriz) ) );
@@ -529,14 +527,14 @@ public class FontView01 {
c.addShape( new Label(options.renderModes, font, 1f, text).setColor(0, 0, 0, 1).setInteractive(false).setDragAndResizeable(false) );
}
- static void setGlyphInfo(final Font font, final Label label, final char symbol, final Font.Glyph g) {
- label.setText( getGlyphInfo(symbol, g) );
+ static void setGlyphInfo(final Font font, final Label label, final Font.Glyph g) {
+ label.setText( getGlyphInfo(g) );
if( VERBOSE_GLYPHS ) {
System.err.println( label.getText() );
}
}
- static String getGlyphInfo(final char symbol, final Font.Glyph g) {
+ static String getGlyphInfo(final Font.Glyph g) {
final OutlineShape os = g.getShape();
final int osVertices = null != os ? os.getVertexCount() : 0;
final String name_s = null != g.getName() ? g.getName() : "";
@@ -546,9 +544,9 @@ public class FontView01 {
g.getFont().getFullFamilyName(),
g.getFont().getMetrics().getAscent() - g.getFont().getMetrics().getDescent(), // font hhea table
g.getFont().getLineHeight(), // font hhea table
- (int)symbol, g.getID(), name_s,
+ (int)g.getCodepoint(), g.getID(), name_s,
bounds.getWidth(), bounds.getHeight(), box_s,
- g.getAdvance(),
+ g.getAdvanceWidth(),
g.getLeftSideBearings(),
osVertices);
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
index e495186c3..5048e911e 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -353,7 +353,7 @@ public class UIGraphDemoU01a {
final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
int idx = 0;
@Override
- public void visit(final char symbol, final Glyph glyph, final AffineTransform t) {
+ public void visit(final Glyph glyph, final AffineTransform t) {
System.err.println("idx["+idx+"]: "+glyph);
++idx;
}
@@ -361,11 +361,11 @@ public class UIGraphDemoU01a {
final AABBox txt_box_r2 = font.processString(visitor, null, text, new AffineTransform(), new AffineTransform());
System.err.println("XXX: txt_box_r2 "+txt_box_r2);
{
- final Glyph g = font.getGlyph( font.getGlyphID(' '));
+ final Glyph g = font.getGlyph( ' ' );
System.err.println("XXX: space "+g);
}
{
- final Glyph g = font.getGlyph( font.getGlyphID('\t'));
+ final Glyph g = font.getGlyph( '\t' );
System.err.println("XXX: tab "+g);
}
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
index 396e5b07b..495739f7e 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
@@ -446,7 +446,7 @@ public class UILayoutBox01 {
g.forAll( (shape) -> { System.err.println("Shape... "+shape); return false; });
scene.addShape(g);
{
- final float X_width = font.getGlyph(font.getGlyphID(' ')).getAdvance();
+ final float X_width = font.getGlyph( ' ' ).getAdvanceWidth();
/**
* G 23, size[total 2.1 x 1.7, cell 1.0 x 0.5]
* Padding[t 0.05, r 0.05, b 0.05, l 0.05]
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
index dc865045a..97a1d81f0 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
@@ -326,7 +326,7 @@ public class UILayoutBoxGridOffset01 {
g.forAll( (shape) -> { System.err.println("Shape... "+shape); return false; });
scene.addShape(g);
{
- final float X_width = font.getGlyph(font.getGlyphID(' ')).getAdvance();
+ final float X_width = font.getGlyph( ' ' ).getAdvanceWidth();
/**
* ID 23: G 23, size[total 2.1 x 1.7, cell 1.0 x 0.5]
* Padding[t 0.05, r 0.05, b 0.05, l 0.05]
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
index ac2663c43..82a91d53c 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
@@ -414,7 +414,7 @@ public class UILayoutGrid01 {
g.forAll( (shape) -> { System.err.println("Shape... "+shape); return false; });
scene.addShape(g);
{
- final float X_width = font.getGlyph(font.getGlyphID(' ')).getAdvance();
+ final float X_width = font.getGlyph( ' ' ).getAdvanceWidth();
/**
* ID 23: G 23, size[total 2.1 x 1.7, cell 1.0 x 0.5]
* Padding[t 0.05, r 0.05, b 0.05, l 0.05]
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
index ef492a207..9e0ac22ff 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -175,9 +175,9 @@ public class UISceneDemo03 {
//
final Font font = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerif.ttf",FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(), true);
// final Font font = FontFactory.get(IOUtil.getResource("jogamp/graph/font/fonts/ubuntu/Ubuntu-R.ttf",FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(), true);
- System.err.println("Font: " + font.getFullFamilyName());
+ System.err.println("Font FreeSerif: " + font.getFullFamilyName());
final Font fontStatus = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf", FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(), true);
- final Font fontSymbols = FontFactory.get(FontFactory.SYMBOLS).getDefault();
+ System.err.println("Font Status: " + fontStatus.getFullFamilyName());
final Scene scene = new Scene(options.graphAASamples);
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f }, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
@@ -608,7 +608,7 @@ public class UISceneDemo03 {
buttonsRight.setLayout(new GridLayout(buttonWidth, buttonHeight, Alignment.Fill, new Gap(buttonHeight*0.50f, buttonWidth*0.10f), 7));
{
- final Button button = new Button(options.renderModes, fontSymbols, " \uE034 ", buttonWidth, buttonHeight); // pause
+ final Button button = new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("pause")+" ", buttonWidth, buttonHeight); // pause
button.setToggleable(true);
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
@@ -626,7 +626,7 @@ public class UISceneDemo03 {
buttonsRight.addShape(button);
}
{
- final Button button = new Button(options.renderModes, fontSymbols, " \uE01F ", buttonWidth, buttonHeight); // next (ffwd)
+ final Button button = new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("fast_forward")+" ", buttonWidth, buttonHeight); // next (ffwd)
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
@@ -638,7 +638,7 @@ public class UISceneDemo03 {
buttonsRight.addShape(button);
}
{
- final Button button = new Button(options.renderModes, fontSymbols, " \uE042 ", buttonWidth, buttonHeight); // rotate
+ final Button button = new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("replay")+" ", buttonWidth, buttonHeight); // rotate (replay)
button.setToggleable(true);
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
@@ -687,7 +687,7 @@ public class UISceneDemo03 {
buttonsRight.addShape(button);
}
{
- final Button button = new Button(options.renderModes, fontSymbols, " \uE3AF ", buttonWidth, buttonHeight); // snapshot (camera)
+ final Button button = new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("camera")+" ", buttonWidth, buttonHeight); // snapshot (camera)
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
@@ -697,7 +697,7 @@ public class UISceneDemo03 {
buttonsRight.addShape(button);
}
{
- final Button button = new Button(options.renderModes, fontSymbols, " \uE8AC ", buttonWidth, buttonHeight); // exit (power off)
+ final Button button = new Button(options.renderModes, fontSymbols, " "+fontSymbols.getUTF16String("power_settings_new")+" ", buttonWidth, buttonHeight); // exit (power_settings_new)
button.setColor(0.7f, 0.3f, 0.3f, 1.0f);
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override