PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

How to change font ing GDI?

Code:

LOGFONT lf;
strcpy(lf.lfFaceName, "GothicG");
f = CreateFontIndirect(&lf;);

...
Code:

SelectObject(hdc, f);

with
Code:

GetTextFace(hdc, 32, buf);

I see that current font is GothicG
but... Text drawed on screen by SYSTEM font...
What is doing the drawing? Is it your code or some other window? If the latter then it may be setting the font each time it draws.

Dan East
Does the gothic font actually exist on the device?
If not you won;t see it.
i add font with this command

AddFontResource("gothic_g.ttf");

and i try draw text on GAPIDraw surface with
DrawText() function
If you use CGapiSurface::DrawText you need to prerender the fonts you want to use as bitmapped fonts using the tool "FontMaker" included with the GapiDraw distribution (you will find it in the "misc" folder). Please check the GapiDraw documentation for details on how to use the font bitmap created with FontMaker, at:
http://www.develant.com/doc/gapidraw/30 ... -frame.htm
He's asking how to do fonts with GDI, not with GapiDraw.
Thierry: He wrote:

"and i try draw text on GAPIDraw surface with
DrawText() function"

It actually has happened that people try to send in TTF fonts and typecast them as CGapiBitmap fonts... :)

Anyway, if he's using GapiDraw it would be a better choice nevertheless to prerender the TTF font with FontMaker - it preserves all font features including kerning for the individual characters...
:oops:
Thierry
Johan
I talk about GDI DrawText() function, not member of GAPIDraw surface...
And i didn't think that using font from bitmap is better... If i need very nice and unusual font i use bitmap, but now i need TTF font...

P.S. Johan About GapiDraw Surface::DrawText()
if i have problems with GapiDraw i wrote in GapiDraw group, do u think? ;)
My bits n pieces relate to PF but should help:

GDI fonts with GAPI applications like PocketFrog (documented by me in my articles).
In the text strings you can use things like /n/r to format text to wrap. see
http://www.sundialsoft.freeserve.co.uk/pocket_frog_Ch3.htm re: GDI fonts.

There's a little GDI font source here which may help:- http://www.sundialsoft.freeserve.co.uk/pfkeyboard.htm
Conan
tnx