mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.77k stars 439 forks source link

Text rendering improvements #143

Open mosra opened 8 years ago

mosra commented 8 years ago

The text rendering library didn't age well and while trying to use it for the upcoming UI library (mosra/magnum-extras#2, not there yet) I got really angry at the shameful state of it. My previous job revolved around text a lot and, while this library was the prototype that I built upon, the actual real-world text rendering needed a lot more flexibility than what's provided here. Putting this braindump here before it fades away completely.

If somebody wants to tackle one of these things, I will be glad to help you and suggest a direction.

Things that are shitty and need to be fixed ASAP

Things that need to be improved/fixed before going further

Making the renderer usable with real-world text and font features

Having automatic font fallback would make the engine better than 90% of competitors.

Improved text rendering capabilities

Unicode-aware text shaping

Improved text editing capabilities

For the UI.

Plugins

Tools

Shaders and rendering

Making the renderer usable with BIDI

Specs: http://unicode.org/reports/tr9/

mosra commented 8 years ago

New tech just keeps appearing: https://github.com/Chlumsky/msdfgen

mosra commented 8 years ago

Color emoji in OTF fonts: https://github.com/googlei18n/color-emoji, https://github.com/googlei18n/noto-emoji Yay!

mosra commented 8 years ago

Safe-to-break API appearing in HarfBuzz: https://github.com/behdad/harfbuzz/issues/224

ytain commented 8 years ago

Also for inspiration to get more creative with text rendering: https://www.youtube.com/watch?v=q3ROZmdu65o (found from there https://news.ycombinator.com/item?id=10824989 )

Also another one https://github.com/behdad/glyphy - Vector based SDF

ytain commented 8 years ago

Another article on rendering using vectors instead of bitmaps https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac#.gdsqful7b

mosra commented 8 years ago

@ytain wow, that vector rendering is really neat! Knew about Glyphy but forgot to add it. Updated the list, thank you!

mosra commented 8 years ago

stb_truetype font plugin merged: https://github.com/mosra/magnum-plugins/pull/12

mosra commented 8 years ago

More emoji fonts: http://emojione.com/, https://github.com/Ranks/emojione/tree/master/assets/fonts

ghost commented 8 years ago

@mosra I've been using stb_truetype, but will we ever get an AnyFontImporter or something?

mosra commented 8 years ago

@Alicemargatroid there's currently not much use of AnyFont-like plugin, because the engine supports mainly just the TTF format.

I think you might want to use the TrueTypeFont plugin alias -- it maps to StbTrueTypeFont, FreeTypeFont or HarfBuzzFont based on which one of them is available, so then you don't need to bother about particular plugin implementation in you app.

mosra commented 5 years ago

Qt has a nice new tool for generating distance fields, appending them to the original TTF/OTF file: https://blog.qt.io/blog/2018/10/10/introducing-distance-field-generator/ Support for such files (and ability to generate compatible files directly with magnum-fontconverter) could be very beneficial.

mosra commented 5 years ago

Progress: