Is it possible to specify a font using CSS in JavaFX application? I have an FXML scene and the corresponding CSS file. In Java code, it\'s possible to specify a font using t
JavaFx CSS fonts (import .ttf):
/* import fonts */
@font-face {
font-family: "Open Sans";
font-style: normal;
font-weight: 400;
src: url("/fonts/OpenSans-Regular.ttf");
}
@font-face {
font-family: "Open Sans Light";
font-style: normal;
font-weight: 300;
src: url("/fonts/OpenSans-Light.ttf");
}
@font-face {
font-family: "Open Sans Bold";
font-style: normal;
font-weight: 700;
src: url("/fonts/OpenSans-Bold.ttf");
}
@font-face {
font-family: "Open Sans ExtraBold";
font-style: normal;
font-weight: 900;
src: url("/fonts/OpenSans-ExtraBold.ttf");
}
/* Set fonts */
.settings-name{
-fx-font-size: 33px;
-fx-font-family: "Open Sans Light";
-fx-font-weight: 300;
-fx-text-fill: #09f;
}
.settings-username{
-fx-font-size: 19px;
-fx-font-family: "Open Sans ExtraBold";
-fx-font-weight: 900;
-fx-text-fill: #09f;
}