Hi all,
I am evaluating ConstrolsFX for improving the look of an Opens Source application developed by a good friend of mine.
While adding a simple toolbar to the app, I have run into a problem with local font support in the Glyph* classes.
I tried both with IcoMoon and with Google's original Material Design Icon font (
https://github.com/google/material-design-icons).
I have followed the example found in ControlsFX's
HelloGlyphFont.java but I always get an empty square inside the buttons instead of the actual glyph.
I have narrowed down my example as much as possible:
public class GlyphFontTest extends Application {
static {
GlyphFontRegistry.register("materialfont", GlyphFontTest.class.getResourceAsStream("MaterialIcons-Regular.ttf"), 16);
}
private final GlyphFont materialFont = GlyphFontRegistry.font("materialfont");
@Override
public void start(Stage primaryStage) {
HBox root = new HBox();
root.getChildren().add(new Button("", materialFont.create('\ue037'))); // Play
root.getChildren().add(new Button("", materialFont.create('\ue034'))); // Pause
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("GlyphFontTest");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
The file
MaterialIcons-Regular.ttf is located alongside the
GlyphFontTest class in the same package.
I am working on Windows 7 and these are the versions used:
Oracle's JDK: 1.8.0_45
ControlsFX: 8.40.9
Any clue about what I am doing wrong?
Thanks a lot!