IonicWind Software

Aurora Compiler => General Discussion => Topic started by: ExMember001 on July 31, 2006, 12:52:57 AM

Title: problem with EnumFontFamilies api
Post by: ExMember001 on July 31, 2006, 12:52:57 AM
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?
Title: Re: problem with EnumFontFamilies api
Post by: Ionic Wind Support Team on July 31, 2006, 06:49:19 AM
Search the forum for unicode functions.  The built in conversions are A2W and W2A.
Title: Re: problem with EnumFontFamilies api
Post by: ExMember001 on July 31, 2006, 09:29:00 AM
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;

}


Title: Re: problem with EnumFontFamilies api
Post by: Ionic Wind Support Team on July 31, 2006, 09:41:55 AM
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")

Title: Re: problem with EnumFontFamilies api
Post by: Parker on July 31, 2006, 12:34:59 PM
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.
Title: Re: problem with EnumFontFamilies api
Post by: ExMember001 on July 31, 2006, 08:56:03 PM
thanx, ill try to do something with that :)

Title: Re: problem with EnumFontFamilies api
Post by: ExMember001 on August 01, 2006, 09:09:44 PM
finally got it to get the right font name ... this is the function that works...
lstrcpynA(fontname,lpNLF.lfFaceName,32);