Install a font from program code?
Moderator: Rathinagiri
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Install a font from program code?
Hi All,
I want to install a font automatically from an HMG program (this way I must not install it manually).
Someone has done that?
Any help is welcome.
TIA.
I want to install a font automatically from an HMG program (this way I must not install it manually).
Someone has done that?
Any help is welcome.
TIA.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: Install a font from program code?
Maybe help https://community.spiceworks.com/topic/ ... s-remotely
One post is
Copy and paste is by far the easiest option for only 15 computers.
Here I had to install a few fonts on a couple of hundred PC's, so I followed these steps:
http://egilhansen.com/2010/09/29/how-pa ... deployment
Make sure to read comments as the program has been updated since the how-to. Its a bit of faffing around but it works.
One post is
Copy and paste is by far the easiest option for only 15 computers.
Here I had to install a few fonts on a couple of hundred PC's, so I followed these steps:
http://egilhansen.com/2010/09/29/how-pa ... deployment
Make sure to read comments as the program has been updated since the how-to. Its a bit of faffing around but it works.
Last edited by dragancesu on Sat Apr 20, 2019 3:16 pm, edited 1 time in total.
Re: Install a font from program code?
I do it this way:
1. At first, it extracts the font file from the resources:
2. Next, I install the font for private use (the font is available only for my application):
3. When I exit the program, I uninstall the font
1. At first, it extracts the font file from the resources:
Code: Select all
IF !FILE( 'saxmono.ttf' )
STRFILE ( HMG_LoadResourceRawFile ( 'saxmono', RT_RCDATA ), 'saxmono.ttf' )
ENDIF
Code: Select all
AddFont ( 'saxmono.ttf' )
SET FONT TO "saxMono", 13
*---------------------------------*
FUNCTION AddFont( cfontfile )
*---------------------------------*
#define FR_PRIVATE 0x10
#define FR_NOT_ENUM 0x20
Return WAPI_ADDFONTRESOURCEEX( cfontfile, FR_PRIVATE + FR_NOT_ENUM, 0 )
Code: Select all
RemoveFont ( 'saxmono.ttf' )
*---------------------------------*
FUNCTION RemoveFont( cfontfile )
*---------------------------------*
#define FR_PRIVATE 0x10
#define FR_NOT_ENUM 0x20
Return WAPI_REMOVEFONTRESOURCEEX( cfontfile, FR_PRIVATE + FR_NOT_ENUM, 0 )
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Install a font from program code?
At first, thanks for the response.edk wrote: ↑Fri Apr 19, 2019 8:55 pm I do it this way:
1. At first, it extracts the font file from the resources:2. Next, I install the font for private use (the font is available only for my application):Code: Select all
IF !FILE( 'saxmono.ttf' ) STRFILE ( HMG_LoadResourceRawFile ( 'saxmono', RT_RCDATA ), 'saxmono.ttf' ) ENDIF
3. When I exit the program, I uninstall the fontCode: Select all
AddFont ( 'saxmono.ttf' ) SET FONT TO "saxMono", 13 *---------------------------------* FUNCTION AddFont( cfontfile ) *---------------------------------* #define FR_PRIVATE 0x10 #define FR_NOT_ENUM 0x20 Return WAPI_ADDFONTRESOURCEEX( cfontfile, FR_PRIVATE + FR_NOT_ENUM, 0 )
Code: Select all
RemoveFont ( 'saxmono.ttf' ) *---------------------------------* FUNCTION RemoveFont( cfontfile ) *---------------------------------* #define FR_PRIVATE 0x10 #define FR_NOT_ENUM 0x20 Return WAPI_REMOVEFONTRESOURCEEX( cfontfile, FR_PRIVATE + FR_NOT_ENUM, 0 )
I've forgot to take a look at hbwin
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Install a font from program code?
Thanks for the response too. This is a very good alternative.dragancesu wrote: ↑Fri Apr 19, 2019 7:48 pm Maybe help [url]https://community.spiceworks.com/t ... s-remotely[/url]
One post is
Copy and paste is by far the easiest option for only 15 computers.
Here I had to install a few fonts on a couple of hundred PC's, so I followed these steps:
http://egilhansen.com/2010/09/29/how-pa ... deployment
Make sure to read comments as the program has been updated since the how-to. Its a bit of faffing around but it works.
And... the first link says: "404"
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: Install a font from program code?
Ops, wrong link, look now
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Install a font from program code?
Thanks. It's ok now!
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Install a font from program code?
mmmmm.....
Algo estoy haciendo mal, no logro que se muestre en la aplicación este tipo de font.
*------------------------------------------------------------------------------------------------------
mmmmm .....
Something I'm doing wrong, I can not get this kind of font to show on the application.
Algo estoy haciendo mal, no logro que se muestre en la aplicación este tipo de font.
*------------------------------------------------------------------------------------------------------
mmmmm .....
Something I'm doing wrong, I can not get this kind of font to show on the application.
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.