Loading of embedded fonts via CSS causes runtime issues
Closed this issue · 2 comments
When loading fonts via CSS, it is required that the absolute path to the font does not contain any spaces. Spaces will be encoded as %20
in the path and passed to the loading function directly, resulting in a failure.
This bug occurs when the project is launched directly in the IDE, and when the project directory or any of the parent directories contains a space in its name. It does not affect any JAR files.
@kouyk thanks for reporting this.
@se-edu/tech-team-level1 should we switch to the solution suggested in the S/O post above?
I noticed the StackOverflow answer states that it is a bug in JavaFX 8, so I tested it myself. (Windows10, Java11, JavaFX11)
Still threw the same error anyway:
Can confirm that this effectively works:
public class Main {
public static void main(String[] args) {
Font.loadFont(Main.class.getResourceAsStream("font/Roboto-Medium.ttf"), 16);
Application.launch(MainApp.class, args);
}
}
So yea, we can switch to the solution if embedded fonts are used.