Autoloading/porting fonts

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Autoloading/porting fonts

Post 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.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Autoloading/porting fonts

Post 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.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Autoloading/porting fonts

Post 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.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Autoloading/porting fonts

Post by *ghisler(Author) »

Try sending WM_USER+21 (which would be Nr. 1045) to Total Commander to reload fonts.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: Autoloading/porting fonts

Post by *Fla$her »

PostMessage(AUTORUN_TCHANDLE, 1045) worked! Thanks! :)
Overquoting is evil! 👎
Post Reply