How do I make my program take fonts from a given folder?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

How do I make my program take fonts from a given folder?

#1 Post by Eugene Lutsenko »

hi!

Users of the Eidos system not from Russia are faced with the fact that they have questions displayed on screen forms wherever Cyrillic is used. I understand that they simply do not have the necessary fonts in Windows. How do I make my program take fonts from a given folder?
http://aidos.byethost5.com/map5.php
Attachments
Безымянный.jpg
Безымянный.jpg (551.99 KiB) Viewed 2522 times

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: How do I make my program take fonts from a given folder?

#2 Post by skiman »

Hi,

Code: Select all

	
	cFont := '.\fonts\thisismyfont.ttf'	// subfolder fonts contains the font
	DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", cFont )
Best regards,

Chris.
www.aboservice.be


k-insis
Posts: 97
Joined: Fri Jan 28, 2011 4:07 am

Re: How do I make my program take fonts from a given folder?

#4 Post by k-insis »

Mind that this effects system only until next reboot.


https://learn.microsoft.com/en-us/windo ... tresourcea

This function installs the font only for the current session. When the system restarts, the font will not be present. To have the font installed even after restarting the system, the font must be listed in the registry.
Eugene Lutsenko wrote: Tue Nov 08, 2022 9:50 am Thanks a lot, skiman !

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: How do I make my program take fonts from a given folder?

#5 Post by skiman »

Hi,

Yes, you need to load it every time at startup.

When you close your application you can do the following, to release the font.

Code: Select all

DllCall("GDI32.DLL", DLL_STDCALL, "RemoveFontResourceA", cFont )
Best regards,

Chris.
www.aboservice.be

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How do I make my program take fonts from a given folder?

#6 Post by Eugene Lutsenko »

Thanks, I'll take it into account

But so far so:
http://lc.kubagro.ru/__AidosALL.txt

Search: "n InstallFonts()"

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How do I make my program take fonts from a given folder?

#7 Post by Eugene Lutsenko »

I made the release of fonts during the normal logout. How do I find out the correspondence of ttf file names and font names?

k-insis
Posts: 97
Joined: Fri Jan 28, 2011 4:07 am

Re: How do I make my program take fonts from a given folder?

#8 Post by k-insis »

Windows api function GetFontResourceInfo (gdi32.dll) that does that

BOOL GetFontResourceInfo(LPCTSTR lpszFilename, // font file name
LPDWORD cbBuffer, // size of buffer for resouce information
LPVOID lpBuffer, // buffer for returned resouce information
DWORD dwQueryType, // resouce information query type
);

There was post on superuser:

https://superuser.com/questions/1432800 ... mmand-line


Eugene Lutsenko wrote: Wed Nov 09, 2022 11:54 am I made the release of fonts during the normal logout. How do I find out the correspondence of ttf file names and font names?

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: How do I make my program take fonts from a given folder?

#9 Post by Eugene Lutsenko »

I would like to download only those fonts that are actually used in the Eidos system. There are not so many of them, they take up less space and it happens faster.

Post Reply