Search code examples
c++openglfreetype

Drawing Font Effects (Underline, Strickeout) freetype Library and OpenGl


I use this link to draw text with a specific Font using freeType Library:

http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/

How can I underline or strikeout text?


Solution

  • A "font effect" is nothing more than drawing text and then drawing something on top of it. An underline font is exactly what it looks like: drawing text, then drawing a line under it. In the case of OpenGL, you would use line rendering. Strikethrough is simply a matter of drawing that light higher.

    The only real question is where to draw the line. For underlines, you draw it at the baseline. For strikethrough, you draw it maybe 2/5ths of the way from the baseline to the top. Or whatever looks good.