• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Little Windows text problem

## Recommended Posts



HFONT hFont;

m_base = glGenLists(96);

hFont =  CreateFont(fontSize,			// font size

0,
0,
0,
FW_LIGHT,	// font weight

FALSE,		// Italic

FALSE,		// Underline

FALSE,      // Strikethrough

ANSI_CHARSET, // character set

OUT_TT_PRECIS, // ouput precision

CLIP_DEFAULT_PRECIS, // clipping precision

ANTIALIASED_QUALITY,	// output quality

FF_DONTCARE | DEFAULT_PITCH,	// family and pitch

fontName);	// font name

if(!hFont)
{
Engine.logFile.Output("Could not load font - %s", fontName);
return;
}
else
{
Engine.logFile.Output("Font loaded successfully - %s", fontName);
}

SelectObject(hDC, hFont);

wglUseFontBitmaps(hDC, 32, 96, m_base);


I was wondering if this looks for the file in the window/font directory automatically. Basically I want to store the .ttf file in my game folders so i can distribute it with my game for use anywhere. Is this possible?? Thanx --------------------------------------------------------------------------------------------------------------------------------------- "With my feet upon the ground I move myeslf between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - TOOL ---------------------------------------------------------------------------------------------------------------------------------------
[TheBlackJester ] Edited by - TheBlackJester on March 21, 2002 5:51:56 PM

##### Share on other sites
i dunno, but why not put it in the fonts directory when you install?

##### Share on other sites
Like, just install it to their windows font directory when I install the game on their comp?

---------------------------------------------------------------------------------------------------------------------------------------
"With my feet upon the ground I move myeslf between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - TOOL
---------------------------------------------------------------------------------------------------------------------------------------
[TheBlackJester ]

[edited by - TheBlackJester on March 21, 2002 8:28:36 PM]

##### Share on other sites
Howdy BlackJester !
CreateFont searches the font file in %SYSTEM%\FONTS. In my opinion you should install the font files in the windows font directory like any other program. Don''t forget to uninstall it later. If you want to load the font in some custom directory you should try that :

  CreateFont(.....,"C:\TBJ\myfont.ttf");

But I am not sure if that works.

##### Share on other sites
Howdy BlackJester !
CreateFont searches the font file in %SYSTEM%\FONTS. In my opinion you should install the font files in the windows font directory like any other program. Don''t forget to uninstall it later. If you want to load the font in some custom directory you should try that :

  CreateFont(.....,"C:\TBJ\myfont.ttf");

But I am not sure if that works.

sorry

thnx i''ll try

##### Share on other sites
Just call AddFontResource("filename.ttf") at the beginning of your program to add your font to the system font table. Then you can use CreateFont() with the name of the font.

##### Share on other sites
Oh yeah, don''t forget to call RemoveFontResource() before your program exits to uninstall the font.

Beautiful,

Thank you

##### Share on other sites
Beautiful,

Thank you

<script LANGUAGE="java-script">
---------------------------------------------------------------------------------------------------------------------------------------
"With my feet upon the ground I move myeslf between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - TOOL
---------------------------------------------------------------------------------------------------------------------------------------
[TheBlackJester]
</script>

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627678
• Total Posts
2978605

• 12
• 12
• 10
• 12
• 22