I use CreateFontIndirect to create the fonts for my apps. This requires that I create a LOGFONT structure in my data section and fill it with all of the appropriate information. I have created an addin to do that for you. It is added to the project menu, enable it with the AddIn manager after copying the DLL to your Addins folder.

When you select Font builder from the project menu, a choose font dialog will appear. Choose your font and size as well as effects (underline etc...) and press OK. A line will be inserted at the current cursor position with a filled LOGFONT structure in the following format:

Arial_Black_10 LOGFONT <-13,0,0,0,400,-1,1,1,0,3,2,1,34,"Arial Black">

The output string is built with wsprintf so that if another assembler (besides GoAsm and Masm) uses a different syntax it is easy to add the functionality. I have not done that but will if someone posts a filled LOGFONT structure for me to use as a template.

When you want to use the font, you include the following in your code

invoke CreateFontIndirect, offset Arial_Black_10
Posted on 2004-03-14 22:18:32 by donkey
It's a bit tricky in HLA, but if it can be done, this would make a great addition!

Arial_Black_10 :w.LOGFONT:=w.LOGFONT:[-13,0,0,0,400,-1,1,1,0,3,2,1,34,strToBA("Arial Black",w.LF_FACESIZE)];

It's kind of a hack. Should come with a note that the "strToBA" macro can be found in the HLA examples release. Randy put that together for me when I needed to do this in HLA.

As you may guess, I'm not too happy about the way HLA implements static structure filling. Leaves me wondering.. .why?
Posted on 2004-03-15 01:09:38 by Kain
Hi Kain,

No problem at all, new upload with your HLA format.
Posted on 2004-03-15 01:19:03 by donkey
Thanks!
Another excellent add-in. :alright:


Just one minor change change request. Please remove the default effects flags.
Posted on 2004-03-15 08:23:08 by Kain
Hi Kain,

I'm not sure what you mean, I do not set any defaults at all. But I do not zero the structure before calling ChooseFont, are you having a problem with the effects ?

The dialog should be clear when it starts:
Posted on 2004-03-15 08:31:30 by donkey
It's not a big deal, just cosmetic.

When I start it up, Strikeout and Underline are selected by default and there is a 3 in the point size box.

Running on WinME.
Posted on 2004-03-15 14:10:30 by Kain
Weird that yours is initialized and mine is not, at any rate it is not a big fix. New upload at the top...
Posted on 2004-03-15 14:14:24 by donkey
It's probably a Windows thing. Anyways, it's fixed now. Thanks.
Posted on 2004-03-15 14:40:18 by Kain
Hi Donkey and Kain, it's not windows's bug, i'm using WinMe and i have the same problem. In win XP everything is nomal.
Posted on 2004-03-17 06:45:46 by neverending

Hi Donkey and Kain, it's not windows's bug, i'm using WinMe and i have the same problem. In win XP everything is nomal.


But it works now right ?
Posted on 2004-03-17 09:41:10 by donkey
Hi Donkey :)
Now, i've tested in my XP SP1 , this error appear again
This is pictures
Posted on 2004-03-17 20:40:07 by neverending
Hi neverending,

Well, there is not much I can do about it. I zero the structures before calling ChooseFont so it should not be initialized. Besides that I am out of ideas, you can try downloading the version from my site it is the latest but it should be exactly the same as the one here.
Posted on 2004-03-17 20:49:48 by donkey
The latest test version (l) of RadAsm has the older Font Builder. Are you sure you're using the latest one?
Also, you may have the older version in your browser cache. Try to clear your cache and download again.


Heh. This already came in handy for me. I usually use default font because I'm too lazy to look up API, fill out the structure, then fix the inevitable mistakes that creep in when doing things manually. Now it's a snap...5 seconds and I have a filled out font structure.
Posted on 2004-03-17 23:10:22 by Kain
Hi Kain,

Glad it helped out a bit

Added support for NASM, the structure is initialized as follows, I got this from the docs so I am not sure if it is exactly right, still looking for TASM and FASM...

Arial_Black_10:

ISTRUC LOGFONT
AT LOGFONT.lfHeight, dd -13
AT LOGFONT.lfWidth, dd 0
AT LOGFONT.lfEscapement, dd 0
AT LOGFONT.lfOrientation, dd 0
AT LOGFONT.lfWeight, dd 400
AT LOGFONT.lfItalic, db 0
AT LOGFONT.lfUnderline, db 0
AT LOGFONT.lfStrikeOut, db 0
AT LOGFONT.lfCharSet, db 0
AT LOGFONT.lfOutPrecision, db 3
AT LOGFONT.lfClipPrecision, db 2
AT LOGFONT.lfQuality, db 1
AT LOGFONT.lfPitchAndFamily, db 34
AT LOGFONT.lfFaceName, db 'Arial Black'
IEND
Posted on 2004-03-18 00:55:59 by donkey
Thanks pelaillo,

Added the FASM initialized logfont format to the possible outputs, this completes the structures for all supported assemblers.
Posted on 2004-03-19 09:14:12 by donkey