flat assembler
Message board for the users of flat assembler.

Index > Windows > How to make a font resource using fasmw macros?

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 15 Feb 2006, 20:00
How would you define a font resource using fasmw's resource macros?
Post 15 Feb 2006, 20:00
View user's profile Send private message Reply with quote
dr_dred



Joined: 29 May 2005
Posts: 5
Location: Earth
dr_dred 16 Feb 2006, 13:08
;in make.bat:
...
rc.exe rsrc.rc
...

;in .asm file:
...
section '.rsrc' resource from 'rsrc.res' data readable
Post 16 Feb 2006, 13:08
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 17 Feb 2006, 07:05
By macros I mean:
Code:
  directory 24, manifest,\
            RT_MENU,menus

  ; resource subdirectories
  resource manifest, 1, LANG_NEUTRAL, xpstyle

  resource menus,\
           37,LANG_ENGLISH+SUBLANG_DEFAULT,main_menu

  menu main_menu
       menuitem 'File',0,MFR_POPUP
                menuitem 'Open',ID_MYMENU_FILE_OPEN,0
                menuitem 'Close',ID_MYMENU_FILE_CLOSE,0
                menuitem 'Exit',ID_MYMENU_FILE_EXIT,MFR_END
       menuitem 'Help',0,MFR_POPUP + MFR_END
                menuitem 'About...',ID_MYMENU_HELP_ABOUT,MFR_END

  resdata xpstyle
    file '%fasminc%\winxpstyle.xml'
  endres
    
Post 17 Feb 2006, 07:05
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 17 Feb 2006, 18:01
try this:
Code:
directory [....] \
            RT_FONT,font
[...]
resource font,[whatever],LANG_NEUTRAL,fontd
[...]
resdata fontd
file [..whatever file]
endres
    

please tell me if it works, and tell me if it doesn't.
Post 17 Feb 2006, 18:01
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 18 Feb 2006, 11:59
I didn't try it, but I don't think it would work. There are two types of font resources RT_FONTDIR and RT_FONT. AFAIK, they both need to be somehow assembled into executable. The question is how to achieve this? Smile
Post 18 Feb 2006, 11:59
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 19 Feb 2006, 08:42
UCM, I've tried that and doesn't work so far, I'm trying to load a font for use that is not in the windows font folder, but with no luck so far. There is no easy way to do it, this is stupid! It would have been nice for Microsoft to include a simple "LoadExternalFont" function.
Post 19 Feb 2006, 08:42
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 19 Feb 2006, 18:31
try the AddFontResource function.
does that work for you?
(p.s. then you would load the font with CreateFont)
Win32 API reference wrote:
int AddFontResource(
LPCTSTR lpszFilename // pointer to font-resource filename
);

_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 19 Feb 2006, 18:31
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 19 Feb 2006, 19:34
Hello Everyone,
First of all, thaks to everyone for there help. I think I've found a way to do it, and without bloating your executable with font files! Download the code below and see if this works on you system (see WM_CREATE where all the setting up is done, and WM_PAINT for the text printing and WM_DESTROY for closing the font and removing the resouce) :


Description: Laoding fonts without resources
Download
Filename: NewFonts.rar
Filesize: 18.18 KB
Downloaded: 245 Time(s)

Post 19 Feb 2006, 19:34
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.