I want to use the "Another Danger" font in my project. However JavaFX isn't quite liking it. Labels and buttons seem to estimate the height of the letters wrong and take a completely wrong size.
I wrote a simple example illustrating the problem:
public class HelloApplication extends Application {
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) {
Button button = new Button("Test");
Scene scene = new Scene(button, 320, 240);
button.setFont(Font.loadFont(HelloApplication.class.getResourceAsStream("/fonts/AnotherDanger-Demo.otf"), 30));
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
}
The text in the button is clearly not centered. However, when I remove the custom font everything works perfectly. Is this a problem with the font? And if so is there any way to fix this?
I'd be very thankful for any help here.
EDIT: Here are screeshots as requested:
With the font:
Without the font:

