Reputation: 83
I am in strife.
I am using a Bahnschrift Variable Font as a font for all of the text & labels of my JavaFX program. However, when I am going to use a variant of the font, the font only appears as the regular variant of the font.
More specifically, the title class doesn't show the Bold Bahnschrift Variant but only shows the Regular Bahnschrift Variant. I am also considering it to be condensed but the program doesn't seem to recognize it; so I am also asking how to make this possible.
For reference, here are the CSS files:
HelpPane.css
@import "standard.css";
.scroll-pane > .viewport, .scroll-pane {
-fx-background-color: #ffffff22;
-fx-border-color: #00000000;
}
.title {
-fx-font-size : 30px;
-fx-font-weight : bold;
}
.heading1 {
-fx-font-size : 24px;
}
sample.css
@font-face {
src: url('file:src/assets/font/Bahnschrift.ttf');
}
.label, .text {
-fx-font-family: "Bahnschrift";
-fx-text-fill: #000000;
}
Upvotes: 2
Views: 716
Reputation: 83
I think that JavaFX doesn't support variable fonts.
Checking the JavaFX CSS documentation, there are no -fx-font-feature-settings
and -fx-font-variable-settings
declarations in the documentation, and even appending format("opentype-variations")
to the font url
declaration can't help either. -fx-font-weight
didn't even make a dent.
Even JavaFX's FXML and Java code doesn't give a compromise.
As of the moment, static fonts might as well be recommended.
Upvotes: 2
Reputation: 321
Not all fonts have support for multiple font weights. Have you made sure that this is not the case for the font you've chosen?
Upvotes: 0