Notice: Updates on this topic have been moved 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.
- Calculate the size of GUI objects before creating them. Or after changing the font of an object.
- Get the default GUI margins. The original reason I started this project. Useful for spacing multiple objects when the margins are unknown.
The pertinent files are as follows:
- Project: Fnt.zip (Includes the Fnt library and example scripts)
- Documentation: Font Library
A few considerations:
- Preview release. This is still a preview release of this library. Everything is subject to change.
- Compatibility. The library was designed to run on all versions of AutoHotkey and all versions of Windows >= Window XP. The reality is that I only have one machine to test this software on. If you experience any problems with your version of AutoHotkey and/or your version of Windows, please let me know. I will try to correct the problem.
- Examples. Most of the examples are ready to go but a few lack maturity and/or enough documentation. These weaknesses will be improved in future releases. If you have issues with any of the examples, please let me know. I will try to correct the problem.
Scripts that use the Fnt library:
- Set Tooltip Width
http://www.autohotke...ts/#entry584860
I hope that someone finds this library useful.
---------------------------------------------------------------------------
Release Notes
v0.1 (Preview)
First release.
v0.2 (Preview)
New Functions:
- Fnt_EnumFontFamExProc (internal function) - The default EnumFontFamiliesEx callback function for the Fnt library. Currently used by Fnt_GetListOfFonts.
- Fnt_GetListOfFonts - Generate a list of font names.
- Fnt_IsFixedPitchFont - Returns TRUE if the font is a fixed pitch font.
- Fnt_IsTrueTypeFont - Returns TRUE if the font is a TrueType font.
- Fnt_IsVectorFont - Returns TRUE if the font is a vector font.
Updates/Enhancements:
- Fnt_ChooseFont. Changes: 1) SizeMin and SizeMax options added to the p_Options parameter. These options allow the developer to limit the range of font sizes that can be entered/selected. 2) Added p_Flags parameter. [Optional] Additional ChooseFont flags can be added via this parameter. Note: The p_Flags parameter is an advanced feature.
- Fnt_GetFontOptions. Changes: 1) Added a "w{font weight}" return option to indicate the weight of the font. This option is only returned if the font weight is not normal (400) and not bold (700). 2) The "bold" return option is now only returned if the font weight is exactly 700.
- Added and updated examples.
v0.3 (Preview)
New Functions:
- Fnt_GetStringWidth - Shell call to Fnt_GetStringSize to get the width of the specified string.
Updates/Enhancements:
- Minor changes to a few functions.
- Added example to set the font of a tooltip. Thanks to uname for the idea.
v0.4 (Preview)
New Functions:
- Fnt_GetMaxStringSize - Calculates the size of a multiline string. Thanks to Verdlin for the idea.
Fixes/Updates/Enhancements:
- Fixed Fnt_ChooseFont to work on x64. Thanks to maestrith for identifying many of the correct offsets for x64 and to okram for identifying the outstanding offsets and for testing all of the changes.
- Minor changes to a few functions to correctly support x64.
- Added example to set the width of a tooltip.
- Added example to calculate the the complete size (w+h) of various controls.
v0.5 (Preview)
Fixes/Updates/Enhancements:
- Fnt_ChooseFont updated to no longer use the AutoHotkey "SetFormat, Integer" command which could potentially slow down some scripts.
- Fnt_GetFont and Fnt_SetFont updated to work on both visible and hidden windows.
- Minor documentation updates.