Skip to content

Numeric fontWeight is rejected by the profile parser #7690

@TBBle

Description

@TBBle

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.508]
Windows Terminal version (if applicable): Windows Terminal Preview Version: 1.3.2382.0

Any other software? Fira Code 5.2: https://github.com/tonsky/FiraCode/releases/tag/5.2

Steps to reproduce

(How I got there, starting from a working setup, is hidden inside the fold. It shouldn't affect the reproduction, but is here in case there is something relevant hidden there.)

Details

Starting from a working default profile:

  "profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles.
      "colorScheme": "Canon Solarized Dark",
      "fontFace": "Fira Code Retina",
      "fontSize": 14,
      "padding": "0, 0, 0, 0",
      "cursorShape": "filledBox"
    },
    "list": [
//...
    ]
  },

with the Fira Code TTFs (six files, one for each of Bold, Light, Mediuma, Regular, Retina, SemiBold) installed.

I then removed the Fira Code TTFs, and installed the Variable TTF (FiraCode-VF.ttf).

Samples in white-on-black are from the Windows "Font Properties" dialogs.

After this change, my terminal looked like this: image which is Consolas Regular at 14pt:
image, but with better anti-aliasing. (Or rather, with any anti-aliasing, I suspect)

This makes sense, since there isn't a "Fira Code Retina" font anymore on my machine, although some kind of notification that my font wasn't found would have been nice. Also, I would have expected a fallback to Cascadia Code, not Consolas. Cascadia Code is installed on my machine as part of the Windows Terminal package (twice, once for Preview, once for regular), so it seems like a better fallback?

I initially tried to move the 'Retina' from the fontFace to the fontWeight

  "profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles.
      "colorScheme": "Canon Solarized Dark",
      "fontFace": "Fira Code",
      "fontSize": 14,
      "fontWeight": "Retina",
      "padding": "0, 0, 0, 0",
      "cursorShape": "filledBox"
    },
    "list": [
//...
    ]
  },

but that's not in the hard-coded list of named font-weights. I was disappointed that it wasn't just asking the chosen font if the fontWeight given matched to a font instance name, but not super-disappointed:

I saw in the profile schema and settings implementation that I could pass in a uint to fontWeight, if there was no existing hard-coded name for my desired weight.

I looked up the weight of the Retina instance in the Fira Code variable TTF (450), and got:

  "profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles.
      "colorScheme": "Canon Solarized Dark",
      "fontFace": "Fira Code",
      "fontSize": 14,
      "fontWeight": "450",
      "padding": "0, 0, 0, 0",
      "cursorShape": "filledBox"
    },
    "list": [
//...
    ]
  },

Expected behavior

I get the same font I had when using Fira Code Retina as my fontFace and no fontWeight setting, with the Fira Code non-variable TTF files installed, i.e. 6 separate TTFs, one for each of Bold, Light, Mediuma, Regular, Retina, and SemiBold.

Actual behavior

Windows Terminal raises an error about the fontWeight value:

image

and then ignores the entire theme configuration, including my colour scheme setting.

So yeah, unlike above, I was super-disappointed this time. As a workaround, I'm using "fontWeight": "medium".


If I comment-out the fontWeight, it looks like this: image
which appears to be 'Regular' instance (weight 400): image rather than 'Retina' instance (weight 450): image which makes sense, if the default value for fontWeight is 'normal'.

Side-note: I was inspired to make this change by noticing that Cascadia Code recommends their Variable TTF over the fixed-size TTFs, and also #107 (comment)

Metadata

Metadata

Assignees

Labels

Needs-AttentionThe core contributors need to come back around and look at this ASAP.Needs-Tag-FixDoesn't match tag requirementsResolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions