Wezterm: Font-Loading Warning on Windows after Font-Loader updates

Created on 23 Nov 2020  路  6Comments  路  Source: wez/wezterm

After experiencing a huge slowdown, in the first version (9ca428c4e1a71cca9c07450826a604b2fa76974c), a later commit improved to startup speed on windows very much (4500510d5cd97c348d7642d78c536dfad5994db4), but unfortunately wezterm shows me now this warning:

Unable to load a font matching FontAttributes { family: "Fairfax Nerd Font",
bold: true, italic: false, is_fallback: false }. Fallback(s)
                     are being used instead, and the terminal may not
                     render as intended

Environment (please complete the following information):

  • OS: Windows 10
  • Version: wezterm 20201101-103216-403d002d-50-g534cdfe

I am using a "nerd font version" of this font here: (custom patch)
https://www.kreativekorp.com/software/fonts/fairfax.shtml

Configuration

font_size = 9.0,
font = wezterm.font("Fairfax Nerd Font", {bold = false, italic = false}),
font_antialias = "Greyscale",
font_hinting = "Full",
bold_brightens_ansi_colors = false,

Additional context

using font_rules, fixes the warning for me:

font_rules = {
        {
          italic = false,
          intensity = "Normal",
          font = wezterm.font("Fairfax Nerd Font", {bold = false, italic = false}),
        },
        {
          italic = false,
          intensity = "Bold",
          font = wezterm.font("Fairfax Nerd Font", {bold = false, italic = false}),
        }
    },
bug

Most helpful comment

I'm sort of on the fence about this; it is legitimately telling you about a font fallback issue due to a missing bold font that was previously a silent problem and could lead to confusion and/or bug reports (see https://github.com/wez/wezterm/issues/320#issuecomment-727757475 that @dmfay encountered).

I do recognize that this represents some noise vs. the prior release.

I could suppress this by causing the synthesized font_rules entries to be marked as fallback items, or alternatively, spend some energy on the error message to make it a bit easier to understand the meaning of it and the resolution for it eg: find and install the bold font variant, or to add explicit font_rules to the config.

I'm leaning towards the latter!

All 6 comments

I'm sort of on the fence about this; it is legitimately telling you about a font fallback issue due to a missing bold font that was previously a silent problem and could lead to confusion and/or bug reports (see https://github.com/wez/wezterm/issues/320#issuecomment-727757475 that @dmfay encountered).

I do recognize that this represents some noise vs. the prior release.

I could suppress this by causing the synthesized font_rules entries to be marked as fallback items, or alternatively, spend some energy on the error message to make it a bit easier to understand the meaning of it and the resolution for it eg: find and install the bold font variant, or to add explicit font_rules to the config.

I'm leaning towards the latter!

we now show messages like this for this sort of situation:

Configuration Error: Unable to load a font matching one of your font_rules: wezterm.font('Operator Mono SSm Lig Medium', {bold=true, italic=false}). Note that wezterm will synthesize font_rules to select bold and italic fonts based on your primary font configuration. Fallback(s) are being used instead, and the terminal may not render as intended. A bold or italic variant of the font was requested; TrueType and OpenType fonts don't have an automatic way to produce these font variants, so a separate font file containing the bold or italic variant must be installed. See https://wezfurlong.org/wezterm/config/fonts.html for more information

Hm, maybe I'm a bit dense, but I've been trying to get my font config to work with variants of Operator Mono modified for ligatures for the past two hours. Can't get the warnings to go away.

This is the config I have.

local wezterm = require 'wezterm';

function font_with_fallback(name, params)
  local names = {name, "Noto Color Emoji", "FuraCode Nerd Font"}
  return wezterm.font_with_fallback(names, params)
end

return {
  -- Font
  font_size = 12.0,
  font_antialias = "Greyscale", -- None, Greyscale, Subpixel
  font_hinting = "Full",  -- None, Vertical, VerticalSubpixel, Full
  line_height = 1.2,

  font_rules = {
    {
      italic = false,
      bold = false,
      intensity = "Normal",
      font = font_with_fallback("Operator Mono SSm Lig Book", { italic = false, bold = false }),
    },

    {
      italic = true,
      bold = false,
      intensity = "Normal",
      font = font_with_fallback("Operator Mono SSm Lig Book", { italic = true, bold = false }),
    },

    {
      italic = true,
      bold = true,
      intensity = "Bold",
      font = font_with_fallback("Operator Mono SSm Lig Bold Italic", { italic = false, bold = false }),
    },

    {
      italic = false,
      bold = true,
      intensity = "Bold",
      font = font_with_fallback("Operator Mono SSm Lig Bold", { bold = false, italic = false }),
    },

    {
      italic = false,
      bold = false,
      intensity = "Half",
      font = font_with_fallback("Operator Mono SSm Lig Medium", { bold = false, italic = false }),
    },

    {
      italic = true,
      bold = false,
      intensity = "Half",
      font = font_with_fallback("Operator Mono SSm Lig Medium", { italic = true, bold = false }),
    },
  },
}

I get the following output.

Unable to load a font matching FontAttributes { family: "Operator Mono SSm Lig
Book", bold: false, italic: false, is_fallback: false }. Fallback(s)
                     are being used instead, and the terminal may not
                     render as intended

Unable to load a font matching FontAttributes { family: "Operator Mono SSm Lig
Book", bold: false, italic: false, is_fallback: false }. Fallback(s)
                     are being used instead, and the terminal may not
                     render as intended

Unable to load a font matching FontAttributes { family: "Operator Mono SSm Lig
Bold", bold: false, italic: false, is_fallback: false }. Fallback(s)
                     are being used instead, and the terminal may not
                     render as intended

Any tips?

Sorry for the confusion around this; this was a bit broken in master for a few revs and then got fixed; your config looks like mine did in some of the broken revs.

Here's how to make sense of it:

  • A font has a family name like Operator Mono SSm Lig and then a full name like Operator Mono SSm Lig Medium that factors in the font weight/boldness and italics.
  • Ideally your config would just use the family name and then select the styling via the bold and italic attributes, (eg: for a bold variant: font_with_fallback("Operator Mono SSm Lig", {bold=true})) but the operator mono lig fonts are a bit of a mess in this respect.
  • To match against the full name of the font, you just want to use font_with_fallback("Operator Mono SSm Lig Medium") without any of the bold or italic modifiers (that's what I use for this font).

Thanks for the tips. Yes, this is basically the configuration you share in the docs. What you say is pretty much what I also understood yesterday. I've tried it once more with the nightly (WezTerm-macos-20201101-103216-403d002d-71-g58eb8e36). With the following config, the problem persists.

local wezterm = require 'wezterm';

function font_with_fallback(name)
  local names = {name, "Noto Color Emoji", "FuraCode Nerd Font"}
  return wezterm.font_with_fallback(names, {})
end

return {
  -- Font
  font_size = 12.0,
  font_antialias = "Greyscale", -- None, Greyscale, Subpixel
  font_hinting = "Full",  -- None, Vertical, VerticalSubpixel, Full
  line_height = 1.2,

  font = font_with_fallback("Operator Mono SSm Lig Book"),
  font_rules = {
    {
      italic = false,
      bold = false,
      intensity = "Normal",
      font = font_with_fallback("Operator Mono SSm Lig Book"),
    },

    {
      italic = true,
      bold = false,
      intensity = "Normal",
      font = font_with_fallback("Operator Mono SSm Lig Book Italic"),
    },

    {
      italic = false,
      bold = true,
      intensity = "Bold",
      font = font_with_fallback("Operator Mono SSm Lig Bold"),
    },

    {
      italic = true,
      bold = true,
      intensity = "Bold",
      font = font_with_fallback("Operator Mono SSm Lig Bold Italic"),
    },

    {
      italic = false,
      bold = true,
      intensity = "Half",
      font = font_with_fallback("Operator Mono SSm Lig Medium"),
    },

    {
      italic = true,
      bold = true,
      intensity = "Half",
      font = font_with_fallback("Operator Mono SSm Lig Medium Italic"),
    },
  },
}

Output

Unable to load a font matching one of your font_rules: wezterm.font('Operator
Mono SSm Lig Book', {bold=false, italic=false}). Fallback(s) are being used
instead, and the terminal may not render as intended. See
https://wezfurlong.org/wezterm/config/fonts.html for more information

Unable to load a font matching one of your font_rules: wezterm.font('Operator
Mono SSm Lig Book', {bold=false, italic=false}). Fallback(s) are being used
instead, and the terminal may not render as intended. See
https://wezfurlong.org/wezterm/config/fonts.html for more information

Unable to load a font matching one of your font_rules: wezterm.font('Operator
Mono SSm Lig Bold', {bold=false, italic=false}). Fallback(s) are being used
instead, and the terminal may not render as intended. See
https://wezfurlong.org/wezterm/config/fonts.html for more information

I see how font family and full name are different from a front like JetBrains Mono. But I like my operator and I paid a lot of money for it. 馃槄 Anyhow, this a pretty complex open source project and I bet you have your hands full. I don't expect further support. Thanks a lot and keep up the good work.

Wondering, if this issue should be closed, as my initial question was answered and the UX improved

Was this page helpful?
0 / 5 - 0 ratings