Hi Yuri,
I do it this way:
Declare two local or global external functions:
// GDI32.dll
function long AddFontResourceExW( readonly string as_FontFile, ulong aul_FontCharacteristics, ulong aul_Reserved ) library "GDI32.dll" alias for "AddFontResourceExW"
function boolean RemoveFontResourceExW( readonly string as_FonfFile, ulong aul_FontCharacteristics, ulong aul_Reserved ) library "GDI32.dll" alias for "RemoveFontResourceExW"
Load the font before using with:
public function long of_addfont (readonly string as_fontfile):
long ll_rc
ll_rc = AddFontResourceExW( as_FontFile, 16 /* FR_PRIVATE 0x10 */ + 32 /* FR_NOT_ENUM 0x20 */, 0 )
return ll_rc
and unload it after using with:
public function boolean of_removefont (readonly string as_fontfile):
boolean lb_rc
lb_rc = RemoveFontResourceExW( as_FontFile, 16 /* FR_PRIVATE 0x10 */ + 32 /* FR_NOT_ENUM 0x20 */, 0 )
return lb_rc
...of_AddFont( "c:\Temp\MyFont.ttf" )
// Use font
... of_RemoveFont( "c:\Temp\MyFont.ttf" )
I called "of_AddFont()" on application start and "of_RemoveFont()" on application close.
Hope this helps,
Regards
Bernhard
Thank you Bernhard.
-Yuri