potocpav / xi_glium

Glium-based front-end to the xi editor
MIT License
84 stars 13 forks source link

Font rendering with glium_text is really ugly #9

Open mrandri19 opened 8 years ago

mrandri19 commented 8 years ago

Maybe we could use another library like freetype. I don't know how to implement the change though.

themasch commented 8 years ago

While I wouldn't really say that its "ugly", at least not on linux, I think that a editor ui could benefit from a specialized font/text rendering engine, too. We would need features like ligatures etc. Maybe this engine could also solve things like displayable whitespace?

I'll collect some resources on the topic in this thread if its okay. I'll also start working on an implementation but I can't promise a PR in the near future ;)

Most of these papers try to deal with opengl font rendering in 3D applications. Thats an issue we shouldn't have to deal with (at least, not until we start supporting text editing in VR ;)).

"Higher Quality 2D Text Rendering": http://jcgt.org/published/0002/01/04/paper.pdf

There is this paper from Valve on a improved method using textured quads for each character: http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf

And heres some StackOverflow on the topic: http://stackoverflow.com/questions/5262951/what-is-state-of-the-art-for-text-rendering-in-opengl-as-of-version-4-1 http://stackoverflow.com/questions/2071621/how-to-do-opengl-live-text-rendering-for-a-gui

And the OpenGL Wikibook on this topic: https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_01

vandenoever commented 8 years ago

For longer lines, the rendering degrades. Here's screenshots for two files.

seq -s ' ' 1 1 10 > short.txt
seq -s ' ' 1 1 100000 > long.txt

short long

Loading the file with one long line wreaks havoc on my graphics card, probably due to allocating huge bitmap.