   Outline Fonts
  I'm trying to use outline fonts in OpenGL. I read the tutorial at nehe.gamedev.net, but I still have many questions...If I use 96 characters, 32 to 127, can the GLYPHMETRICSFLOAT array have 96 elements? Or I'll have to have 127 elements?If I draw text at a position given by glTranslatef() [used before glCallLists()], will the given y value be the text's bottom or top?How do I calculate the total height of a drawn character sequence (that can include '\n' ) ?Can I create a font of size 1 and then be able to use the font with any size by using glScalef(fontsize,fontsize,1.0f) ?[Edited by - Tom Backton on June 27, 2009 1:36:29 AM]
  Recently tinkered with the Freetype library and have found a lot to like there. FTGL is based on it and would seem a no-brainer... were it not for some attachments to deprecated features (e.g. attribute stacks). Not terribly difficult to get the basics rolling directly from Freetype. The package comes with ample docs and a couple of example progs to get you up speed.If you're tired of farting around with platform specific font code this might be the ticket for you.   ;  I'm not tired... I just need some information. I'm not the only one who uses OpenGL outline fonts, right? I'm sure someone knows the answers.   ;  Can someone please help me by answering (at lease one of) the questions? (Does nobody use outline fonts?)Help will be highly appreciated :)   ;If I use 96 characters, 32 to 127, can the GLYPHMETRICSFLOAT array have 96 elements? Or I'll have to have 127 elements?Your array can be 96 elements. However, element 0 will correspond to character 32, so you will need to take this into account when using it in future code.If I draw text at a position given by glTranslatef() [used before glCallLists()], will the given y value be the text's bottom or top?Without trying this in practice, I believe it will be at the text's top.How do I calculate the total height of a drawn character sequence (that can include '\n' ) ?I'm not sure, since font sizes are in points, whereas you will want it in Pixels. However, I've found them to be not that disimilar.Can I create a font of size 1 and then be able to use the font with any size by using glScalef(fontsize,fontsize,1.0f) ?Yes, but it will look horrific.   ;Quote:Can I create a font of size 1 and then be able to use the font with any size by using glScalef(fontsize,fontsize,1.0f) ?I'm assuming you're referring to this function, wglUseFontOutlines().  This function ignores whatever font size you pass to it, so, you will have toscale it to whatever size you need.  The last time I looked at it, I couldn't find a clear way to scale it to a specific point size, like 12.In your glScalef() example, fontsize != pointsize.  Scaling factor needs to be in some kind of device coordinates.And since wglUseFontOutlines() creates the font as polygons and not as a texture, you will have issues dealing with anti-aliasing.You would need to turn on multi-sampling or render it to a texture before drawing it to the backbuffer.[Edited by - theequal on June 24, 2009 2:29:25 PM];  Thanks for the answers! But I have another question...I decided to use texture fonts since they are faster and don't depend on the existence of the fonts on the user's computer (because the texture is created by the game creator, not during runtime).I'll probably use a long texture with the 96 characters in one row. And there will be a display list for each character. The x increment after each character will be taken from the gmf array (I'll create the texture by drawing character outlines on the screen and using glCopyTexImage2D() ). The question is : what is the y difference between lines? Is it constant? How do I calculate it?   ;  If you are using a premade texture, wouldn't you already know what the height of each char is? I would keep the same height for each character. The width can vary.   ;  I do know what the characters' height is, but I need to know the y difference between LINES. I CAN read it from a file, but I'm also programming the font texture CREATOR, so I need to know which height I need to write to the font file.I read a Freetype OpenGL example at nehe.gamedev.net , and the y difference between lines there is H/0.63 ; H is the characters' height. Is it a standard number? Is there a standard or I can simply choose a number for which multiline text looks natural?   ;  Check the Freetype documentation. I remember there being a way to get the baseline information from the font itself, as it was designed to be typeset. Advancing baseline based on character size is, in general, dangerous, as different characters are of different size, and some characters may even (by design) extend into adjacent lines of text.   