Page 1 of 1

Autoloading/porting fonts

Posted: 2025-03-24, 03:32 UTC
by Fla$her
Autorun has a Loadfont function that allows you to use loaded fonts in Total Commander and plugins.
The problem for fonts selected in TC settings is that the plugin doesn't have time to load them before TC initializes them, so you have to execute cm_FontConfig, toggle the checkbox back and forth and confirm.

If there was a possibility to port fonts by means of TC itself (from %COMMANDER_PATH%\Fonts\, for example) or at least to wait for their loading by Autorun before rendering, it would be great.

Re: Autoloading/porting fonts

Posted: 2025-03-24, 17:22 UTC
by ghisler(Author)
I need more information on how you load fonts with autorun, and how TC could know when a font is being loaded, and when it's done.

Re: Autoloading/porting fonts

Posted: 2025-03-24, 20:10 UTC
by Fla$her
The function parameter is the font path relative to the TC folder (or full). autorun.cfg:

Code: Select all

LoadFont Fonts\Fontname.ttf
LoadFont '%COMMANDER_PATH%\Fonts\Fontname2.otf'
Autorun.wdx is always at the top of the plugin list, LoadFont functions are executed first. To find out that the font is loaded, you can check the number with the EXTENDED macro and send a message (for example, 7777777) with the font file name in wparam, which TC will accept:

Code: Select all

LoadLibrary Plugins\Autorun_Runtime.dll
LoadFont Fonts\FontName.ttf
If EXTENDED > 0 Then SendMessage(AUTORUN_TCHANDLE, 7777777, 'Fonts\FontName.ttf', 0, 1)
I suppose you know what to do with the received name.

Re: Autoloading/porting fonts

Posted: 2025-03-25, 09:22 UTC
by ghisler(Author)
Try sending WM_USER+21 (which would be Nr. 1045) to Total Commander to reload fonts.

Re: Autoloading/porting fonts

Posted: 2025-03-25, 14:17 UTC
by Fla$her
PostMessage(AUTORUN_TCHANDLE, 1045) worked! Thanks! :)