JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
422 stars 36 forks source link

Custom font family in Kotlin project #102

Closed PoslavskySV closed 2 years ago

PoslavskySV commented 2 years ago

Dear Colleagues,

thank you very much for excellent software. We use lets-plot directly in Kotlin (not in Jupyter) to generate plots. Is there a way to use custom fonts: say I have a ttf font in the resources - how I can make lets-plot see it when using geomText(family = "myFontFamily") / axes labels etc?

Thanks! Stanislav

alshan commented 2 years ago

Hi Stanislav, font on axis, legends and titles is not yet customizable unfortunately.

Does geomText(family=..) work for you? I believe it should.

PoslavskySV commented 2 years ago

Regarding geomText(family=..) - I have a custom .ttf font file (not a system-wide), so I believe I need to make it recognizable by lets-plot?

alshan commented 2 years ago

Try to register your custom font in the platform, either by using GraphicsEnvironment.registerFont() or via Font Configuration Files.

Once your font family is available in runtime you must (in theory) be able to use it in geom_text().