ConFont plugin for TCC/LE
Version 1.0.5.1 2024-02-28
Charles Dye
Purpose:
This plugin implements the FONT
command
and the @FONT
function in TCC/LE. Windows
Vista or later is required; it will not load under earlier versions.
Installation:
To use this plugin, copy ConFont.dll to some
known location on your hard drive. (If you are still using the 32-bit version
of TCC/LE, take ConFont-x86.dll instead of
ConFont.dll.) Load the .DLL file with a
PLUGIN /L
command, for example:
plugin /l c:\bin\tcmd\test\confont.dll
If you copy the .DLL file to a subdirectory named PlugIns within your TCC/LE program directory, ConFont will be loaded automatically when TCC/LE starts.
Plugin Features:
Syntax Note:
The syntax definitions in the following text use these conventions for clarity:
BOLD CODE | indicates text which must be typed exactly as shown. |
CODE | indicates optional text, which may be typed as shown or omitted. |
Bold italic | names a required argument; a value must be supplied. |
Regular italic | names an optional argument. |
ellipsis… | after an argument means that more than one may be given. |
New Command:
FONT
— Show or change the console font.
Syntax:
FONT
/B /F: /L /N: /Q /W: /X: /Y:
n
Compatible options: | |
/F: nop | do-nothing option for TCC compatibility; ignored |
/N: name | typeface name; quote it if it contains spaces or other problematic characters |
/W: n | font weight: 400 normal, 700 bold |
/X: n | character width in pixels |
/Y: n | character height in pixels |
New options — incompatible with TCC: | |
/B | bold; synonym for /W:700 |
/L | list known console typefaces |
/Q | quietly |
If no arguments are specified, FONT
will display information
about the current console font.
In arguments which take a value, you can replace the colon with an equals sign, or omit it entirely.
This command uses the SetCurrentConsoleFontEx() API, which seems rather flakey, to put it mildly. If no console font exactly matches your request, SetCurrentConsoleFontEx() will either pick a different font at random and report success, or else do nothing… and report success. MSDN claims that this API can also report failure, but I have yet to see that happen. SetCurrentConsoleFontEx() can also cough up an italic font from time to time.
Using any of the options listed under “New features” will break compatibility with TCC.
font /nConsolas /y14
New Function:
@FONT
— Returns information
about the current console font.
Syntax:
%@FONT[
n]
n | which information to return: |
0 : the font name | |
1 : the character width in pixels | |
2 : the character height in pixels | |
3 : the font weight: 400 normal, 700 bold | |
4 : the font family: 48 Terminal, 54 a TrueType font | |
5 : the font index (a completely useless number, so far as I can tell) | |
128 : a descriptive string | |
129 : returns 1 if the current console font supports Unicode, 0 if not |
This function calls GetCurrentConsoleFontEx.
Startup Message:
This plugin displays an informational line when it initializes. The
message will be suppressed in transient or pipe shells. You can disable it
for all shells by defining an environment variable named NOLOADMSG
,
for example:
set /e /u noloadmsg=1
Changes:
Version | Date | Changes |
---|---|---|
1.0.5.1 | 2024-02-28 | Moved the help texts and font-gathering structures into ConFont.cpp. |
1.0.5 | 2024-02-23 | Split the code into ConFontMain.cpp and ConFont.cpp, to allow easier sync with LEMisc. |
1.0.4 | 2024-02-23 | Major changes to support the new Windows 10 “enhanced” console mode, which allows many more fonts (all monospaced modern fonts?) to be used. |
1.0.3 | 2024-02-12 |
FONT /L now shows an asterisk next to the current font name,
if available. Restored the (undocumented) %@CONFONT[129]
and documented it. Removed the startup test for TCC/LE; now this plugin can be loaded in
the full TCC.EXE to replace the built-in FONT command if desired. |
1.0.2 | 2023-11-22 | The “Plugin not loaded” message is not displayed in transient or pipe shells. Updated the copyright message in the VerInfo block to reflect ConFont’s no-longer-beta status. |
1.0.1.1 | 2023-10-13 | Updated the plugin’s web address. |
1.0.1 | 2021-07-31 | Switched the filenames; now ConFont.dll is the x64 build. Tweaked the version info resource to include the platform (x64 or x86). |
1.0.0 | 2016-12-05 | First release. |
Status and Licensing:
This plugin is © Copyright 2024, Charles Dye. Unaltered copies of the binary and documentation files may be freely distributed without restriction. I make no guarantee and give no warranty for its operation. If you find a problem, you can report it in the JP Software support forum.
Download:
You can download the current version of the plugin from http://charlesdye.net/dl/confont.zip.