Little Windows text problem

Started by
9 comments, last by TheBlackJester 22 years ago
Hey, Heres my code for loading a windows font
  

	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

"With my feet upon the ground I lose myself 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." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

Advertisement
i dunno, but why not put it in the fonts directory when you install?
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
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]

"With my feet upon the ground I lose myself 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." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

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

"With my feet upon the ground I lose myself 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." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

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.
Oh yeah, don''t forget to call RemoveFontResource() before your program exits to uninstall the font.
Beautiful,

Thank you

"With my feet upon the ground I lose myself 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." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

This topic is closed to new replies.

Advertisement