April 28, 2024, 02:16:09 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


problem with EnumFontFamilies api

Started by ExMember001, July 31, 2006, 12:52:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ExMember001

the problem is not too call this api ;) the call seems to work fine but the call back is returning strange character
an example is in the debug.txt file attach to this post...

in the vb example he use somekind of string to unicode function just before printing the fontname, but i cant find something similar to use with aurora

does anyone know how to handle this kind of string? and what is these strange characters means?

Ionic Wind Support Team

Search the forum for unicode functions.  The built in conversions are A2W and W2A.
Ionic Wind Support Team

ExMember001

ok , if i search the forum i see that only sapero has use it so far ... well , not good for me :P
as i see i think i must use something like #ifdef UNICODE with the a2w function because if i dont, a2w is saying im undeclared...

so my next questions is (remember that im going on a road ive never tryed before ;) )
how did i use correctly the a2w with something like :


Global sub GetSysFonts(int hdc)
{
EnumFontFamilies(hdc,NULL,&GetSysFontsCallback,0);

return true;
}

Global sub GetSysFontsCallback(LOGFONT lpNLF,NEWTEXTMETRIC lpNTM, int FontType, int LParam),int
{

string fontname;

fontname = a2w(lpNLF.lfFaceName);

messagebox(0,fontname,"")
return true;

}



Ionic Wind Support Team

Sorry I meant s2w and w2s.

string to wide character, wide character to string.  And they are a simple in/out function.  wide = s2w("a string")

Ionic Wind Support Team

Parker

a2w/w2a are the C functions (macros actually). And if you want to specify a unicode literal, prefix it with L. print( L"Unicode" ); // Printing unicode strings doesn't work though last time I checked.

ExMember001

thanx, ill try to do something with that :)


ExMember001

finally got it to get the right font name ... this is the function that works...
lstrcpynA(fontname,lpNLF.lfFaceName,32);