Results 1 to 5 of 5

Thread: Fonts

  1. #1
    Member Newbie
    Join Date
    Jun 2006
    Location
    Coimbatore
    Posts
    40

    Fonts

    Hi,

    I need to display fonts of particular height and width. I created fonts using wglOutlines. But i could not vary the height and width of the font. The code is as follows:

    Code :
    HFONT hFont;
    	GLYPHMETRICSFLOAT agmf[128];	
     
    	LOGFONT logfont;
    	logfont.lfHeight = 12;
    	logfont.lfWidth = 100;
    	logfont.lfEscapement = 0;
    	logfont.lfOrientation = 0;
    	logfont.lfWeight = 400;
    	logfont.lfItalic = 0;
    	logfont.lfUnderline = 0;
    	logfont.lfStrikeOut = 0;
    	logfont.lfCharSet = DEFAULT_CHARSET;
    	logfont.lfOutPrecision = OUT_TT_PRECIS;
    	logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
    	logfont.lfQuality = ANTIALIASED_QUALITY;
    	logfont.lfPitchAndFamily =  DEFAULT_PITCH;
     
    	strcpy(logfont.lfFaceName, "Arial");
     
    	hFont = CreateFontIndirect(&logfont);
     
    	SelectObject(hdc, hFont);
     
    	nFontList = glGenLists(128);
     
    	wglUseFontOutlines(hdc, 0, 128, nFontList, 0.0f, 0.0f, WGL_FONT_POLYGONS, agmf);
     
    	DeleteObject(hFont);
    Sangeetha. J
    Thanks & Regards,
    Sangeetha

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Fonts

    Read the wglUseFontOutlines manual.
    Here's the relevant line:

    "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."

    Means, it ignores the font's lfHeight and uses the em square to generate the full spline data in the [0.0, 1.0] range from the full presicion font data. The em square of TrueType fonts I looked at was 2048.
    You need to scale your OpenGL matrices to adjust font sizes rendered from wglUseFontOutlines.
    When doing that with the modelview matrix on polygonal fonts, enable GL_NORMALIZE to get the lighting right.

  3. #3
    Member Newbie
    Join Date
    Jun 2006
    Location
    Coimbatore
    Posts
    40

    Re: Fonts

    Hi,

    I scale the font to the level i need it to be displayed. Its working. But if a word is there means say, for example, "OpenGL".., then sometimes the starting letter of the word should be at the given coordinate and sometime the last letter should be at the given coordinate. For this, i need to know how much i can translate the X Coordinate.. To translate , each letter has different GLYMPHMETRICS parameter values. Is there any other way to do this..?
    Thanks & Regards,
    Sangeetha

  4. #4
    Member Newbie
    Join Date
    Jun 2006
    Location
    Coimbatore
    Posts
    40

    Re: Fonts

    Hi,

    I corrected the problem. Thanks for replying.

    Sangeetha.
    Thanks & Regards,
    Sangeetha

  5. #5
    Member Newbie
    Join Date
    Jun 2006
    Location
    Coimbatore
    Posts
    40

    Re: Fonts

    Hi,

    I successfully displayed the font at whatever location i want. But one problem i am facing is the weight of the font is not upto the expected. There is no lot of difference if i gave the font weight a different value. But i need to display the font from very thin to thick. Please anyone help me.
    Thanks & Regards,
    Sangeetha

Similar Threads

  1. bitmap fonts vs texture fonts
    By ehsan2004 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-31-2005, 03:24 AM
  2. Fonts
    By Sektor in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 01-02-2003, 03:22 PM
  3. fonts
    By incognito in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-06-2002, 01:03 AM
  4. Fonts: HW vs. SW
    By chennes in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 02-22-2001, 12:25 PM
  5. Fonts
    By BrSchnitz in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 09-22-2000, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean