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

Example on loading fonts does not work from packaged build #323

Open
MonsterDruide1 opened this issue Aug 4, 2022 · 0 comments
Open

Example on loading fonts does not work from packaged build #323

MonsterDruide1 opened this issue Aug 4, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@MonsterDruide1
Copy link

Are you refering to KDocs or GitHub Pages?
The paragraph about loading custom fonts does not work on packaged builds, which are expected to be ran during the SoPra.
https://tudo-aqua.github.io/bgw/components/uicomponents/uicomponents.html#loading-custom-fonts

In case of unclear documentation
As the font file should be loaded from a jarfile, the given code excerpt does not work on those builds, just crashing the entire application on boot. Instead, a code like this should be used:

        val fontResource = SwimApplication::class.java.getResourceAsStream(name) ?: throw FileNotFoundException()
        val tempFile = File.createTempFile("bgw", "font")
        Files.copy(fontResource, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
        loadFont(tempFile)

Additional context
Better code example by @p4czyk

@MonsterDruide1 MonsterDruide1 added the documentation Improvements or additions to documentation label Aug 4, 2022
@dominikmaeckel dominikmaeckel self-assigned this Aug 5, 2022
@dominikmaeckel dominikmaeckel removed their assignment Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants