flat assembler
Message board for the users of flat assembler.

Index > Windows > How to get info for the font CharSet

Author
Thread Post new topic Reply to topic
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi everyone!

I am trying to figure out how to get info for the font charset by giving only a font name

In C++ there is a function 'GetCharsetInfo' and there is also CHARSETINFO structure
but I have no idea how to fill the structure in ASM

I hope someone can give me some information about this topic

regards

_________________
down under
Post 14 Dec 2008, 23:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17347
Location: In your JS exploiting you and your system
revolution
Use TranslateCharsetInfo to fill the CHARSETINFO structure.
Post 15 Dec 2008, 12:11
View user's profile Send private message Visit poster's website Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Thanks for your answer revolution but for that function I need to supply that information which I actually need

In a mid time I have found solution for my need:
I call 'EnumFontFamiliesEx' with proper parameters and get the answer at location lpelfe + 09Ch ('western' or 'symbol' and so on)

I appreciate your effort, thanks

regards
Post 15 Dec 2008, 14:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17347
Location: In your JS exploiting you and your system
revolution
habran wrote:
Thanks for your answer revolution but for that function I need to supply that information which I actually need
Huh, are you sure? The way I read it you only need to supply either the character set value, the code page or the font signature. The TranslateCharsetInfo function fills in the CHARSETINFO structure for you.
Post 15 Dec 2008, 23:45
View user's profile Send private message Visit poster's website Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
No, I just read the CharSet info direct from location
Quote:

lpelfe + 09Ch ('western' or 'symbol' and so on)

here are the code

EnumFontFamExProc proc lpelfe:ENUMLOGFONTEX , lpntme:NEWTEXTMETRICEX , FontType:DWORD, lParam:LPARAM

mov eax, dword ptr lpelfe;.elfFullName
mov edx,extent
add eax,edx;3ch;9ch
push eax
invoke lstrcmp, Head,eax ; check if it is the same name
.if eax ; not the same name
inc index
pop eax
invoke lstrcpy, Tail,eax
m2m Head,Tail
invoke lstrlen, Tail
inc eax
add Tail,eax
.else
pop eax
.endif
mov eax,rval
ret 16
EnumFontFamExProc endp

and Caller is:

invoke GetDC,NULL
mov mDC,eax
invoke lstrcpy,addr lpLogfont.lfFaceName,addr szWork
mov lpLogfont.lfCharSet, DEFAULT_CHARSET
mov extent,09ch
lea eax,CharsetBuff
mov Head,eax
mov Tail,eax
mov index,0
mov rval,1
invoke EnumFontFamiliesEx, mDC,addr lpLogfont,addr EnumFontFamExProc,0,0;
invoke ReleaseDC, NULL, mDC

invoke lstrcmp,addr CharsetBuff,addr szSymbol
.if eax
mov lf.lfCharSet,ANSI_CHARSET
.else
mov lf.lfCharSet,SYMBOL_CHARSET
.endif
invoke lstrcpy, offset FontName, offset lf.lfFaceName
invoke CreateFontIndirect,addr lf
mov hFont,eax
mov al, lf.lfCharSet
mov charF.bCharSet,al;SYMBOL_CHARSET
invoke SendMessage,hEdit, EM_SETCHARFORMAT, SCF_SELECTION, offset charF



regards
Post 16 Dec 2008, 00:06
View user's profile Send private message Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
I just uploaded new version of the MDIRichEditor and if you are interestid how is it done have look Combos.asm and also WndProc ".elseif eax = 81"

don't hesitate to ask for more explanation

regards
Post 16 Dec 2008, 05:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.