This library was first released on the original AutoHotkey forum. You can find the original post here.
Introduction
AutoHotkey handles most of our font needs via the gui Font and GUIControl Font commands. The Fnt library was created to expand on what can be done with fonts.
Fnt Library
Key features:
- Create fonts. Create and delete logical fonts as needed. Yes, this is one way to get around the AutoHotkey upper limit of 200 fonts. Starting with v0.6, creating any of the standard non-client fonts (Ex: Menu font) is a snap.
- Calculate the size of GUI controls before creating them. Or after changing the font of a GUI control. New functions introduced in v3.0 make it even easier to accurately calculate the size for some GUI controls.
- Calculate the tab stops on Edit, Rich Edit, or ListBox controls. New functions released in v0.6 make it much easier to set the tab stops based on actual data.
- Get the default GUI margins. The original reason I started this project. Useful for spacing multiple GUI controls when the margins are unknown.
The pertinent files are as follows:
- Project: Fnt.zip (Includes the Fnt library and example scripts)
- Documentation: Fnt Library
Starting with v2.0, this library is designed to work on all versions of AutoHotkey v1.1+.
Issues/Considerations
A few considerations:
- Windows compatibility. The library is designed to run on all versions of Windows >= Windows XP. The reality is that I only have one machine to test this software on. If you experience any problems with your version of Windows, please let me know. I will try to correct the problem.
- Preview functions. A few functions in the library are experimental/preview. These functions are documented as such. These functions can be modified or deleted at any time.
- DPIScale. The DPIScale feature (AutoHotkey v1.1.11+) can be incompatible with the Fnt library. See the library documentation for more information.
- Tooltips. Recent updates to Windows 7 (it appears to be other versions of Windows as well) has changed how the tooltip control responds to certain messages. The tooltip may no longer automatically redraw when the WM_SETFONT message is sent. Worse yet, if the Redraw option of the WM_SETFONT message is set to TRUE, the tooltip may be deactivated (hidden but not destroyed). Starting with v0.9, the Fnt_UpdateTooltip function was added to work in conjunction with the Fnt_SetFont function when used on a tooltip control. See the documentation in the Fnt_SetFont function for more information.
- Examples. If any of the examples don't work as expected, please let me know. I will try to correct the problem. Also, the examples have been written for the most common screen resolutions - 1920x1080 or higher. Screens with resolutions at least 1280x768 should work fine but there might be a few exceptions. For screens with a resolution less than 1280x768, there may be more than than a few examples that don't display well. If you experience a problem with an example because of screen resolution, let me know. I will try to correct the problem.
- [Library] Fnt - Do Stuff With Fonts
The original post on the AutoHotkey.com forum
https://autohotkey.com/board/topic/9048 ... ith-fonts/
Dialog Template Units
What the heck are they?
https://autohotkey.com/boards/viewtopic ... 379#p25012
Status Bar Font
Setting the font for the status bar.
https://autohotkey.com/boards/viewtopic ... 379#p84987
Tab Stop Size
There are two methods for calculating tab stop size.
https://autohotkey.com/boards/viewtopic ... 26#p173326