Skip to content

Add custom font #68

Closed Answered by camcd93
camcd93 asked this question in Q&A
Discussion options

You must be logged in to vote

Found the answer. It is more to do with cosmictext than glyphon.

  1. Get the FontSystem
  2. Get the FontDict from the FontSystem
  3. The FontDict will have a couple methods to load fonts on it that are public. The only one you should use though is load_fonts_dir. The rest may load the font but won't register it to be accessible by glyphon.

So if I have a directory like:

fonts/MyCustomFont

  • MyCustomFontVariable.ttf
  • static/
    -- MyCustomFontItalic.ttf
    -- MyCustomFontRegular.ttf
    -- etc...
let font_dict = self.font_system.db_mut();
font_dict.load_fonts_dir("fonts/MyCustomFont");

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by camcd93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant