libsdl-org / SDL_ttf

Support for TrueType (.ttf) font files with Simple Directmedia Layer.
zlib License
343 stars 116 forks source link

Fallback fonts on SDL2 #338

Closed laurence-flwls closed 3 weeks ago

laurence-flwls commented 4 months ago

Hi, I'm creating a terminal emulator in SDL2 and finding a lot of characters aren't present in a particular type-face (examples below).

I'd like to be able to define fallback fonts to cover instances were glyphs aren't available in the default type face.

After a bit of searching online, the only reference to this issue I could find was a Github issue from 2019 which sounded like a fix was soon to be merged. However, unless I've missed something obvious in the docs, I cannot find how implement that.

eg: my terminal emulator (SDL2) vs iTerm2 -- under the DEC Special graphics and line drawing heading:

image image

slouken commented 4 months ago

Could you link the GitHub issue you found? I'm not seeing it.

laurence-flwls commented 4 months ago

@slouken my apologies, it wasn't an official SDL repo: https://github.com/grimfang4/SDL_FontCache/issues/29

laurence-flwls commented 4 months ago

So if we ignore the unrelated project, what would be the recommended way to solve my problem here? Because it's a text heavy application, a performant way to validate the glyphs would be preferable.

There is another curveball here though, I'm writing this terminal emulator in Go (golang). I do have some experience in C and older versions of C++ too so I can work my way through a C solution and port it to Go if needed. The only reason I favour Go these days is because it's faster (for me at least) to prototype code.

slouken commented 3 weeks ago

Duplicate of #362, which has better repro steps.