Bug using binary stylesheets: Loading relative @font-face paths are converted to absolute ones

Armin Schrenk armin.schrenk at skymatic.de
Thu Mar 30 09:01:52 UTC 2023


Hi,

binary stylesheets is a more hidden feature of javafx, so before filing 
a bug ticket i'm writing to this mailing list.

As said javafx offers working with binary stylesheets. For example, 
normal css files can be converted into binary ones and later those can 
be used instead to reduce the loading time. The conversion can be done 
programatically, or by calling the main method of Css2Bin.java (see 
https://github.com/openjdk/jfx/blob/19.0.2.1%2B1/modules/javafx.graphics/src/main/java/com/sun/javafx/css/parser/Css2Bin.java).

Also, javafx supports loading fonts via the @font-face rule. As 
"src"-tag you specify an url(...), its format is specified in 
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#typeurl 
with some examples. From the examples, one can see that relative paths 
are supported.

Combining those two features leads to a bug: Converting a css file with 
relative @font-face paths, the resulting bss file contains absolute 
@font-face paths, which makes the app non-portable when used at compile 
time. I looked into the javafx code, and internally the conversion is a 
two step process by first loading the css file into the javafx model, 
and second writing from the model in a file using the binary format. 
During loading the css file, @font-face paths are resolved to absolute 
ones, and the original path is not retained.

Is this intended behaviour?

Kind regards,

Armin Schrenk



More information about the openjfx-dev mailing list