handmade.network » Forums » GUI application rendering and font loading issue
sam_windell
4 posts
#12574 GUI application rendering and font loading issue
3 weeks, 5 days ago Edited by on July 21, 2017, 9:30 a.m.

I have released a cross platform desktop application whose GUI is rendered with nanovg, using OpenGL 2. On the whole this has been a great success. However, there has been a couple of users who have had issues with it. More specifically they use windows 7 with what I believe is Intel integrated graphics.

My code is structured so that nanovg can be swapped out quite easily, so I have played around with the Windows API, Direct2D/DirectWrite as I think this will be more likely better supported, and should be have good performance. Most functionality is pretty reasonable: drawing rects, arcs, gradients, etc. But the DirectWrite side of things seems super complicated. Here is one of windows samples for loading a ttf font...

I need to load a ttf font from a block of memory I give to it. Does anyone have any experience with this? Or recommend anything else to fix this issue in general?
mmozeiko
Mārtiņš Možeiko
1436 posts
1 project
#12578 GUI application rendering and font loading issue
3 weeks, 5 days ago

DirectWrite is not easy to use API, but it should be capable of doing what you want.

To load fonts from memory, you can use IDWriteInMemoryFontFileLoader interface. It will return IDWriteFontFile object that you can pass to IDWriteFactory::CreateFontFace to create actual IDWriteFontFace object.