vallentin / glText

Cross-platform single header text rendering library for OpenGL
zlib License
167 stars 16 forks source link

Monotype. #15

Open synxroform opened 2 years ago

synxroform commented 2 years ago

Is it possible for glyphs to become equal in width, in order to avoid dancing of FPS displays and counters ?

vallentin commented 2 years ago

Currently, not yet. The font is baked into the library, and there is only that variant. Until #10 has been solved, then this isn't really possible to do manually either, or at least easily.

Draradech commented 4 months ago

In my local copy, I added a hack in _gltUpdateBuffers:

#ifdef GLT_HACK_MONOSPACE
    glyphX += 8. + glyphAdvanceX;
#else
    glyphX += glyphWidth + glyphAdvanceX;
#endif

I then define GLT_HACK_MONOSPACE before I include gltext.h (at the same place where GLT_IMPLEMENTATION is defined).

This forces the current font to be rendered with constant glyph width, which is of course incorrect, but depending on your needs may be good enough.