-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text rendering improvements #143
Comments
New tech just keeps appearing: https://github.com/Chlumsky/msdfgen |
Color emoji in OTF fonts: https://github.com/googlei18n/color-emoji, https://github.com/googlei18n/noto-emoji Yay! |
Safe-to-break API appearing in HarfBuzz: harfbuzz/harfbuzz#224 |
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 |
Another article on rendering using vectors instead of bitmaps https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac#.gdsqful7b |
@ytain wow, that vector rendering is really neat! Knew about Glyphy but forgot to add it. Updated the list, thank you! |
|
More emoji fonts: http://emojione.com/, https://github.com/Ranks/emojione/tree/master/assets/fonts |
@mosra I've been using stb_truetype, but will we ever get an AnyFontImporter or something? |
@alicemargatroid there's currently not much use of I think you might want to use the |
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 |
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
0 1 2 0 2 3 4 5 6 4 6 7 ...
over and over again.GL
suffix to make room for Vulkan, WebGPU, etc. implementationsstd::vector
every time we need some array with size known in advance -- 568a420, ab8dc07, 2692ff2...Things that need to be improved/fixed before going further
initialize()
function is broken by design: initializing HarfBuzz plugin after FreeType will callFreeTypeFont::initialize()
second time, finalizing HarfBuzz plugin will callFreeTypeFont::finalize()
even though FreeType plugin is still used and thus breaks it. -- mosra/magnum-plugins@217832fTextureTools::distanceField()
, ensure that it doesn't have artifacts on older platforms, ensure that it works even on GLES and WebGL -- done in 209cdbc, 2e4beb3 and 8ba2cacText::GlyphCache
andText::DistanceFieldGlyphCache
-- 82691fcMaking the renderer usable with real-world text and font features
Having automatic font fallback would make the engine better than 90% of competitors.
TextureTools::Atlas
functionality -- 66bf0b2Image::slice()
that operate withPixelStorage
parameters so we're able to upload image subdataTextureTools::distanceField()
-- ada0645, abf8a75, a2554cbTexture2DArray
for the glyph cache instead ofTexture2D
so we can fit also big alphabets inside. And somehow make it optional or backwards compatible with GLES2 / WebGL 1 that doesn't have them.GL
suffix, to make room for Vulkan, WebGPU etc. implementationsAbility to use cubemaps? Could help on ES2 platforms, it's not an array but it's 6x times as large as a 2D texturenobody cares about ES2 nowadays anymoreaddVariant(size)
/removeVariant(id)
and then using that variant ID increateShaper()
?findFont()
(and third toaddFont()
)vec4(dot())
of the pixel value is usedImproved text rendering capabilities
Unicode-aware text shaping
Make HarfBuzz the go-to solution on all platforms instead of trying to emulate it poorly using other libraries. Works on Linux, should "just work" on OSX, I was able to compile it for Windows using CMake. What about Android? iOS? Emscripten?No. Instead broaden the API to make it possible to fully control HarfBuzz from it while still making it possible to use stb_truetype or plain bitmap fonts where advanced shaping isn't neededAbility to autodetect these in the shaper (http://unicode.org/reports/tr24/ -- I read through it and implemented it, but most of it faded away already. HarfBuzz somehow exposes this in the API so one could maybe take it as a starting point.)Just let HarfBuzz do that on its own.Improved text editing capabilities
For the UI.
Plugins
stb_truetype
to make the usage easier on platforms that don't "just have" FreeType (stb_truetype font plugin magnum-plugins#12)MagnumFont
FreeTypeFont
StbTrueTypeFont
StbTrueTypeFont
to make it less blurry and differing in sizeAnyFont
so one can just not care about which plugin is getting usedOpenTypeFont
alias -- mosra/magnum-plugins@2c36ec4Tools
magnum-fontconverter --info
, like is already done for images and scenesHarfBuzzFontConverter
that implements whathb-subset
does)Shaders and rendering
Having the glyph cache completely on the GPU, passing just a list of glyph IDs and positions and leaving the rest on the shaderhugenon-negligible impact with large textMaking the renderer usable with BIDI
Specs: http://unicode.org/reports/tr9/
AbstractLayouter
interface and expose it via pluginsAbstractLayouter
?The text was updated successfully, but these errors were encountered: