Skip to content

Commit

Permalink
Fix font usability in Windows console apps
Browse files Browse the repository at this point in the history
[why]
The generated fonts do not turn up in the font chooser of Windows CMD
and PowerShell (and probably more).

[how]
For some reasons Windows does not identify the fonts as being strictly
monospaced, so they are hidden in that font choosers.

For the monospaced fonts we set now the Panose proportion 'monospaced'.
Windows seems to honor the Panose properties.

It is not clear why we need to set the old Panose props, especially as
Cascadia Code does not (!) set them and is still detected as monospaced.

Anyhow, the way Windows detects if a font is monospaced is a mystery (at
least for me), and this works, so ;-)

Fixes: #68

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Nov 15, 2021
1 parent 6294cd6 commit 30d4b25
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rename-font
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ delugia.sfntRevision = None # Auto-set (refreshed) by fontforge
delugia.appendSFNTName("English (US)", "Version", args.version)
delugia.version = args.version

if args.name.lower().find("mono"):
# For MS-Windows console apps
panose = list(delugia.os2_panose)
if panose[0] < 3: # https://forum.high-logic.com/postedfiles/Panose.pdf
panose[3] = 9 # 3 (4th value) = propotion: 9 = monospaced
delugia.os2_panose = tuple(panose)

# Save
delugia.generate(args.output)
print("Generated '{}' from {}{} version {}".format(args.output, args.name, args.style, args.version))

0 comments on commit 30d4b25

Please sign in to comment.