Font Size Problems
I am using outline fonts from lesson 14 , but I can''t change the size of the font.I tried changing the following line
font = CreateFont(-12,.......
but the font size doesn''t change no matter what number I use in the height field.In bitmap font''s changing the height parametr works well.
Please Help.
Read the tutorial and it will say how to manipulate the font size. You can use glScalef() as it says in the tut.
Thanx alot for the quick reply!
But why changing font height and width in CreateFont(..) function doesn''t affect the font size???
But why changing font height and width in CreateFont(..) function doesn''t affect the font size???
"More fun stuff. We''re going to create our Outline font. We start off by specifying the size of the font. You''ll notice it''s a negative number. By putting a minus, we''re telling windows to find us a font based on the CHARACTER height. If we use a positive number we match the font based on the CELL height. "
Thats an exact quote from the tut. If you are going to use something from the tutorials, you should read everything because its very helpful to know what everything does.
Thats an exact quote from the tut. If you are going to use something from the tutorials, you should read everything because its very helpful to know what everything does.
I have read this very carefully.But still,changing those numbers DOESN'T affect the font size! I tried different numbers for half an hour.Only the glScalef() changes the font size.
[edited by - Sashka on August 6, 2002 1:28:52 PM]
[edited by - Sashka on August 6, 2002 1:28:52 PM]
msdn is your friend.
the function uses em squared font size to retrieve unhinted truetype outlines from windows. win2k+ can provide unhinted outlines at any font sizes, anything before that cannot. if you want to know more, search google and msdn on truetype fonts, glyph outlines, and hinting.
edit: in a less technical language, what you're seeing is a feature, not a bug, and that behavior is "by design". using scale() is the only way to scale outline fonts.
[edited by - niyaw on August 6, 2002 8:39:36 PM]
quote:
wglUseFontOutlines
The run of glyphs begins with the first glyph of the font of the specified device context. The em square size of the font, the notional grid size of the original font outline from which the font is fitted, is mapped to 1.0 in the x- and y-coordinates in the display lists. The extrusion parameter sets how much depth the font has in the z direction.
the function uses em squared font size to retrieve unhinted truetype outlines from windows. win2k+ can provide unhinted outlines at any font sizes, anything before that cannot. if you want to know more, search google and msdn on truetype fonts, glyph outlines, and hinting.
edit: in a less technical language, what you're seeing is a feature, not a bug, and that behavior is "by design". using scale() is the only way to scale outline fonts.
[edited by - niyaw on August 6, 2002 8:39:36 PM]
I wanted to use outline fonts for printing messages on the screen during my 3d game.Since I translate z position very close to the screen (translatef(0.0f,0.0f,-0.1f) so the message won''t be inside the walls) I have to scale the font size to very small size, and it looks very ugly this way.So I guess I can''t use outline fonts for that purpose.
I tried them because bitmap fonts I used before,weren''t seen on other computers (somebody knows why? I used fonts from tut13).
Also I can''t color my fonts without coloring the whole scene.
Wraping print function with glEnable(GL_COLOR_MATERIAL),glDisable(GL_COLOR_MATERIAL) doesn''t seem to work.Any ideas?
I tried them because bitmap fonts I used before,weren''t seen on other computers (somebody knows why? I used fonts from tut13).
Also I can''t color my fonts without coloring the whole scene.
Wraping print function with glEnable(GL_COLOR_MATERIAL),glDisable(GL_COLOR_MATERIAL) doesn''t seem to work.Any ideas?
quote:
Original post by Sashka
I wanted to use outline fonts for printing messages on the screen during my 3d game.Since I translate z position very close to the screen (translatef(0.0f,0.0f,-0.1f) so the message won''t be inside the walls) I have to scale the font size to very small size, and it looks very ugly this way.
disable depth testing while drawing fonts, and you''ll be able to use any sizes you want.
quote:
So I guess I can''t use outline fonts for that purpose.
jumping to conclusions, aren''t we?
quote:
I tried them because bitmap fonts I used before,weren''t seen on other computers (somebody knows why? I used fonts from tut13).
lesson 13 should work on pretty much anything, more likely you did something wrong to the code.
quote:
Also I can''t color my fonts without coloring the whole scene.
Wraping print function with glEnable(GL_COLOR_MATERIAL),glDisable(GL_COLOR_MATERIAL) doesn''t seem to work.Any ideas?
opengl is a state machine, maybe? changing color keeps it changed until you change it again. restore it to white after drawing the font.
Restoring color to white workes good, now it doesn''t color all the scene. But still 2 problems left: the font itself doesn''t change color, it''s black no matter what I do, and second my friend says on his computer he doesn''t see any text (and he is not only one). Here is the printing code I use
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -0.1f);
glColor3f(1.0f,0.0f,0.0f);
glRasterPos2f(-0.049f, 0.037f);
glPrint("FPS:%d",(int)globalframes);
glColor3f(1.0f,1.0f,1.0f);
Some help here plzzz.
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -0.1f);
glColor3f(1.0f,0.0f,0.0f);
glRasterPos2f(-0.049f, 0.037f);
glPrint("FPS:%d",(int)globalframes);
glColor3f(1.0f,1.0f,1.0f);
Some help here plzzz.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement