korlibs / korlibs/korge

Support MSDF/MTSDF fonts

Open
#1,107 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

Would be nice to be able to generate them on the fly from TTFs/OTFs with a mutable atlas to add glyphs on the fly, so people can just use a normal TTF but render without intermediate textures for specific texts. While still being able to support normal TTF fonts normally rendered for static texts to have as much quality as possible.

References MSDF:

* https://github.com/Chlumsky/msdfgen
* https://github.com/Chlumsky/msdf-atlas-gen
* https://github.com/soimy/msdf-bmfont-xml
* https://levelup.gitconnected.com/msdf-font-rendering-in-webgl-91ce192d2bec
* https://medium.com/@calebfaith/implementing-msdf-font-in-opengl-ea09a9ab7e00
* https://lup.lub.lu.se/luur/download?func=downloadFile&recordOId=9024910&fileOId=9024911
* https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf
* https://github.com/Chlumsky/msdfgen/files/3050967/thesis.pdf : `4.4 Direct multi-channel distance field
construction`

SDF:

* https://github.com/mapbox/tiny-sdf
* https://github.com/dy/bitmap-sdf
* https://github.com/dy/bitmap-sdf/blob/78de3569d32404a7009f62bea3befca55838118a/index.js#L90-L134
* https://cs.brown.edu/people/pfelzens/dt/

Later we should have also emojis in mind. Maybe emojis can be rendered alone in separate bitmaps/textures at a fixed size, and alternatively for COLRv1 fonts we can render vector chunks, and colorize them later.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the linked MSDF, SDF, and font-rendering references to establish the required approach. Define the scope for generating MSDF/MTSDF data from TTF/OTF fonts, mutable glyph atlases, normal static rendering, and the later emoji and COLRv1 considerations; completion criteria are not specified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.