The MASM Forum

General => The Campus => Topic started by: xandaz on December 03, 2018, 02:08:32 AM

Title: LOGFONT problems
Post by: xandaz on December 03, 2018, 02:08:32 AM
    Hello guys and thanks in advance. I've initialized a logfont structure but masm errors. Initializer must be a string or single item:
UCSTR               FontName,"fixedsys.fon",0
logf    LOGFONT     <32,32,0,0,FW_DONTCARE,0,0,0,\
                    DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                    DEFAULT_QUALITY,DEFAULT_PITCH+FF_DONTCARE,offset FontName>
                                       

Title: Re: LOGFONT problems
Post by: jj2007 on December 03, 2018, 02:27:19 AM
Try this, it works fine with UAsm:
logf    LOGFONT     <32,32,0,0,FW_DONTCARE,0,0,0,\
                    DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                    DEFAULT_QUALITY,DEFAULT_PITCH+FF_DONTCARE,<"fixedsys.fon">>
Title: Re: LOGFONT problems
Post by: xandaz on December 03, 2018, 02:38:57 AM
     Ty jj. i'm going to try.
Title: Re: LOGFONT problems
Post by: xandaz on December 03, 2018, 02:41:16 AM
       Errors anyway. Constant value too large. ty for help jj.
Title: Re: LOGFONT problems
Post by: xandaz on December 03, 2018, 03:33:32 AM
   i'm using UNICODE. Didn't realise lfFaceName actually included the string inside the LOGFONT STRUCT. do you know what macro to use with it?
   ty.
Title: Re: LOGFONT problems
Post by: jj2007 on December 03, 2018, 09:00:32 AM
Quote from: xandaz on December 03, 2018, 03:33:32 AM
   i'm using UNICODE.

logf    LOGFONTW     <32,32,0,0,FW_DONTCARE,0,0,0,\
                    DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                    DEFAULT_QUALITY,DEFAULT_PITCH+FF_DONTCARE, <0>>


Then copy the string to its location. Why do you need Unicode here? There are hardly any fonts around with a Unicode name. You would have to use a resource string or similar to get true Unicode. Of course, I could show you the simple MasmBasic solution, but some troll will show up and aggress me... :bgrin:
Title: Re: LOGFONT problems
Post by: aw27 on December 03, 2018, 10:53:17 AM
logf    LOGFONTW     <32,32,0,0,FW_DONTCARE,0,0,0,\
                    DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
                    DEFAULT_QUALITY,DEFAULT_PITCH+FF_DONTCARE, {"f","i","x","e","d","s","y","s",".","f","o","n",0}>   

and there are other ways but I need to leave before JJ triggers the spam button.
Title: Re: LOGFONT problems
Post by: xandaz on December 03, 2018, 04:06:49 PM
   AW, that seems to work. I had to use the index registers to fill the damn structure...ty.
Title: Re: LOGFONT problems
Post by: xandaz on December 03, 2018, 04:48:33 PM
   yeah JJ. Thats what i did. worked fine. ty