User Tools

Site Tools


guides:createafont

This is an old revision of the document!


Bake A Custom SDF Font!

So, you want to make a custom font atlas and

Ingredients

  • The msdf-atlas-gen source code
    You'll need to clone this recursively, so you get the submodules:
    git clone --recurse-submodules https://github.com/Chlumsky/msdf-atlas-gen.git
  • A font file in ttf/otf OpenType formats
  • A C++ compiler
  • Cmake
  • tinyxml2 (install using your package manager, it's tinyxml2 on brew)

Recipe

  1. Build msdf-atlas-gen
    # In the msdf-atlas-gen folder
    # On macOS/unix-like systems:
     
    mkdir build && cd build # create the build folder
    cmake -DMSDF_ATLAS_USE_VCPKG=OFF -DMSDF_ATLAS_USE_SKIA=OFF .. # generate makefile using cmake
    make & cd bin # build and go to the output folder
  2. Generate font files!
    # the magic command
    ./msdf-atlas-gen -type mtsdf -format png -csv FONTNAME.csv -imageout FONTNAME.png -font PATH_TO_FONT_FILE
  3. Copy the generated FONTNAME.csv and FONTNAME.png to the vendor/fonts folder in folk
  4. Edit line this line in display.folk
    # replace the "PTSans-Regular" with FONTNAME
    variable font [font load "PTSans-Regular"]
guides/createafont.1696470896.txt.gz · Last modified: 2023/10/05 01:54 by discord

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki