ConFont plugin for TCC/LE

Version 1.0.6     2025-08-27

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:

New command: FONT

New function: @FONT

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

Examples are shown in a gray box:

rem   This is an example:
font /nConsolas /y14


Some options take an argument. These are shown with a colon between the option and its argument: /A:arg

If you like, you may substitute an equals sign for the colon: /A=arg This is handy if the arg is a filename, and you want to use tab completion to enter the filename.

Or you can omit the colon: /Aarg

New Command:

FONT — Show or change the console font.

Syntax:
FONT /B /F: /L /N: /Q /W: /X: /Y:n

    Compatible options:
/F:nopdo-nothing option for TCC compatibility; ignored
/N:nametypeface name; quote it if it contains spaces or other problematic characters
/W:nfont weight: 400 normal, 700 bold
/X:ncharacter width in pixels
/Y:ncharacter height in pixels
 
    New options — incompatible with TCC:
/Bbold; synonym for /W:700
/Llist known console typefaces
/Qquietly

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.


This command will not work if TCC/LE is running in Windows Terminal (it will show an error message). Windows Terminal is not entirely compatible with the Windows console API.

Using any of the options listed under “New features” will break compatibility with TCC.

font /nConsolas /y14

See also: the @FONT function.



New Function:

@FONT — Returns information about the current console font.

Syntax:
%@FONT[n]

nwhich 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.

Note that this function will cheerfully return nonsense if TCC/LE is running in Windows Terminal. Windows Terminal is not entirely compatible with the Windows console API.

See also: the FONT command.



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:


VersionDateChanges
1.0.6.02025-08-27FONT displays an error message if it detects Windows Terminal. (@FONT still cheerfully returns nonsense.)
1.0.5.12024-02-28Moved the help texts and font-gathering structures into ConFont.cpp.
1.0.52024-02-23Split the code into ConFontMain.cpp and ConFont.cpp, to allow easier sync with LEMisc.
1.0.42024-02-23Major changes to support the new Windows 10 “enhanced” console mode, which allows many more fonts (all monospaced modern fonts?) to be used.
1.0.32024-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.22023-11-22The “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.12023-10-13Updated the plugin’s web address.
1.0.12021-07-31Switched the filenames; now ConFont.dll is the x64 build. Tweaked the version info resource to include the platform (x64 or x86).
1.0.02016-12-05First release.

Status and Licensing:

This plugin is © Copyright 2025, 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 https://charlesdye.net/dl/confont.zip.