Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts shipped with app are not used #2829

Closed
2 tasks done
infeo opened this issue Mar 28, 2023 · 3 comments
Closed
2 tasks done

Fonts shipped with app are not used #2829

infeo opened this issue Mar 28, 2023 · 3 comments
Labels
misc:gui type:bug Something isn't working
Milestone

Comments

@infeo
Copy link
Member

infeo commented Mar 28, 2023

Please agree to the following

Summary

Cryptomator uses the OpenSans font in its GUI. But the font files are actually not used, but the system default font.

What software is involved?

  • Operating System: Windows 11 (possibly all systems)
  • Cryptomator: Cryptomator 1.7.3

Volume Type

None

Steps to Reproduce

  1. Checkout project and compile with maven
  2. Delete all fonts in [projectroot]/src/main/resources/css/
  3. Start Cryptomator via IDE with JVM property javafx.verbose=true

Expected Behavior

Open Sans font is used and console does not show warning:
grafik

Actual Behavior

Any font but Open Sans is used:
grafik

Reproducibility

Always

Relevant Log Output

Mar 28, 2023 3:23:58 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFORMATION: Could not load @font-face font [file:/D:/a/cryptomator/cryptomator/src/main/resources/css/opensans_regular.ttf]
Mar 28, 2023 3:23:58 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFORMATION: Could not load @font-face font [file:/D:/a/cryptomator/cryptomator/src/main/resources/css/opensans_semibold.ttf]
Mar 28, 2023 3:23:58 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFORMATION: Could not load @font-face font [file:/D:/a/cryptomator/cryptomator/src/main/resources/css/opensans_bold.ttf]

Anything else?

No response

@infeo infeo added type:bug Something isn't working misc:gui labels Mar 28, 2023
@infeo
Copy link
Member Author

infeo commented Mar 28, 2023

Might be related to #2606

@infeo
Copy link
Member Author

infeo commented Mar 28, 2023

This bug is caused by using binary CSS. Executing maven, in the compile phase we have the following plugin execution:

cryptomator/pom.xml

Lines 325 to 338 in 4bb0026

<execution>
<id>compile-light-theme</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>javafx.graphics/com.sun.javafx.css.parser.Css2Bin</mainClass>
<arguments>
<arg>${project.basedir}/src/main/resources/css/light_theme.css</arg>
<arg>${project.build.outputDirectory}/css/light_theme.bss</arg>
</arguments>
</configuration>
</execution>

This converts our css file into a binary one. The problem is, that during the conversion, relative paths are resolved to absolutes ones (because technically, this conversion is done in two steps: First loading the stylesheet into the javafx model and second write it in binary form). And during the conversion, the absolute path to the font is /path/to/cryptomator-repo/src/main/resources/css/font.ttf.

@infeo infeo added this to the 1.7.4 milestone Mar 28, 2023
@infeo
Copy link
Member Author

infeo commented Mar 29, 2023

The performance penalty if we switch back to parsing normal css files is roughly 33%, but in absolute terms it would only be a difference of 20ms (on my machine). Additionally, the stylesheet is loaded once.

Therefore, this enhancement will be removed until upstream the issue is resolved.

@infeo infeo closed this as completed in ea2a487 Mar 29, 2023
SailReal added a commit to cryptomator/aur that referenced this issue Apr 5, 2023
SailReal added a commit to cryptomator/aur-bin that referenced this issue Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
misc:gui type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant