wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.67k stars 745 forks source link

`stretch = '<STRETCH_VALUE>'` seems not to be recognized #2348

Closed wimstefan closed 2 years ago

wimstefan commented 2 years ago

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

awesomewm with picom

WezTerm version

wezterm 20220801-212627-119c2f1d

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

When using stretch = 'UltraCondensed' as font attributes they are not recognized.

To Reproduce

Use the configuration below. Run wezterm ls-fonts

Here is the output. Primary font: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-Regular.otf, FontConfig {family="Cartograph CF", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Assumed to have Emoji Presentation "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Bold Italic=false: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-Bold.otf, FontConfig {family="Cartograph CF", weight="Bold", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Assumed to have Emoji Presentation "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Normal Italic=true: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-RegularItalic.otf, FontConfig {family="Cartograph CF", style="Italic", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Assumed to have Emoji Presentation "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Bold Italic=true: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-BoldItalic.otf, FontConfig -- AKA: "Cartograph CF Bold" {family="Cartograph CF", weight="Bold", style="Italic", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Assumed to have Emoji Presentation "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Half Italic=true: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-ExtraLightItalic.otf, FontConfig -- AKA: "Cartograph CF Extra Light" {family="Cartograph CF", weight="ExtraLight", style="Italic", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig -- Will synthesize italics -- Will synthesize dim "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Will synthesize italics -- Will synthesize dim -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Will synthesize italics -- Will synthesize dim "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-italic.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", style="Italic", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Half Italic=false: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-ExtraLight.otf, FontConfig {family="Cartograph CF", weight="ExtraLight", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig -- Will synthesize dim "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Will synthesize dim -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Will synthesize dim "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Bold Italic=false: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-DemiBold.otf, FontConfig {family="Cartograph CF", weight="DemiBold", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig -- Will synthesize bold "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Will synthesize bold -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Will synthesize bold "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-semibold.ttf, FontConfig {family="Iosevka Artesanal", weight="DemiBold", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Bold Italic=true: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-DemiBoldItalic.otf, FontConfig -- AKA: "Cartograph CF Demi Bold" {family="Cartograph CF", weight="DemiBold", style="Italic", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig -- Will synthesize italics -- Will synthesize bold "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Will synthesize italics -- Will synthesize bold -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Will synthesize italics -- Will synthesize bold "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-semibolditalic.ttf, FontConfig -- AKA: "Iosevka Artesanal Semibold" {family="Iosevka Artesanal", weight="DemiBold", style="Italic", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) When Intensity=Normal Italic=true: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-RegularItalic.otf, FontConfig {family="Cartograph CF", style="Italic", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig -- Will synthesize italics "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Will synthesize italics -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Will synthesize italics "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-italic.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", style="Italic", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", }) Title font: wezterm.font_with_fallback({ -- /usr/share/fonts/owned/Sans/Roboto-Bold.ttf, FontConfig {family="Roboto", weight="Bold"}, -- /usr/share/fonts/owned/Mono/cartograph-cf-fonts/CartographCF-Regular.otf, FontConfig {family="Cartograph CF", harfbuzz_features={"liga=1", "ss02"}}, -- /usr/share/fonts/owned/Symbols/nonicons.ttf, FontConfig "nonicons", -- /usr/share/fonts/joypixels/joypixels-6.6.0.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "JoyPixels", -- /usr/share/fonts/owned/Symbols/OpenMoji-Color.ttf, FontConfig -- Assumed to have Emoji Presentation "OpenMoji", -- /usr/share/fonts/owned/Iosevka/iosevka-artesanal-regular.ttf, FontConfig -- Will synthesize dim {family="Iosevka Artesanal", scale=1.1}, -- /usr/share/fonts/owned/Mono/JetBrainsMono/JetBrainsMono[wght].ttf, FontConfig "JetBrains Mono", -- /usr/share/fonts/owned/Symbols/NotoColorEmoji.ttf, FontConfig -- Assumed to have Emoji Presentation -- Pixel sizes: [128] "Noto Color Emoji", -- /usr/share/fonts/owned/Symbols/Symbols-1000-em Nerd Font Complete Mono.ttf, FontConfig "Symbols Nerd Font Mono", -- , BuiltIn "Last Resort High-Efficiency", })

Configuration

local fonts = 'carto'

local function basename(s)
  return string.gsub(s, "(.*[/\\])(.*)", "%2")
end

local my_scheme = require('colors/my_schemes').setup({
  sync = false,
  flavour = 'seoulbones_light'
})

local function font_fallback(name)
  local names = { name, 'nonicons', 'JoyPixels', 'OpenMoji',
    { family = 'Iosevka Artesanal', weight = 'Book', scale = 1.1 } }
  return wezterm.font_with_fallback(names)
end

local function font_set(name)
  local font = {}
  if string.match(name, 'custom') then
    font = font_fallback({ family = 'Rec Mono Custom' })
  elseif string.match(name, 'carto') then
    font = font_fallback({ family = 'Cartograph CF', weight = 'Regular', stretch = 'UltraCondensed',
      harfbuzz_features = { 'liga=1', 'ss02' } })
  end
  return font
end

local function font_rules(name)
  local rules = {}
  if string.match(name, 'custom') then
    rules = nil
  elseif string.match(name, 'carto') then
    rules = {
      {
        intensity = 'Bold',
        italic = false,
        font = font_fallback({ family = 'Cartograph CF', weight = 'Bold', stretch = 'UltraCondensed',
          harfbuzz_features = { 'liga=1', 'ss02' } })
      },
      {
        intensity = 'Normal',
        italic = true,
        font = font_fallback({ family = 'Cartograph CF', weight = 'Regular', stretch = 'UltraCondensed', style = 'Italic',
          harfbuzz_features = { 'liga=1', 'ss02' } })
      },
      {
        intensity = 'Bold',
        italic = true,
        font = font_fallback({ family = 'Cartograph CF', weight = 'Bold', stretch = 'UltraCondensed', style = 'Italic',
          harfbuzz_features = { 'liga=1', 'ss02' } })
      },
    }
  end
  return rules
end

local function font_size(name)
  local size
  if hostname == 'swimmer' then
    if string.match(name, 'custom') then
      size = 10.0
    elseif string.match(name, 'carto') then
      size = 10.4
    end
  elseif hostname == 'tj' then
    if string.match(name, 'custom') then
      size = 10.0
    elseif string.match(name, 'carto') then
      size = 10.0
    end
  end
  return size
end
return {
  -- Colours
  colors = my_scheme,

  -- Fonts
  font = font_set(fonts),
  font_size = font_size(fonts),
  font_rules = font_rules(fonts),
  allow_square_glyphs_to_overflow_width = 'Always',
  custom_block_glyphs = true,
  warn_about_missing_glyphs = false,
}

Expected Behavior

Using stretch = 'UltraCondensed' should change the font stretch. But neither value from stretch = 'UltraExpanded' until stretch = 'UltraCondensed' does modify the font stretch.

Logs

No response

Anything else?

No response

wez commented 2 years ago

Does wezterm ls-fonts --list-system | grep -i carto list fonts that have those stretch variants?

wimstefan commented 2 years ago

Nope. So I guess I was in the wrong assumption that WezTerm could "magically" apply a stretch to any font ... ;) Thanks for taking the time to look into it 🙏

wez commented 2 years ago

I've added a brief note about that to the wezterm.font docs!

wimstefan commented 2 years ago

I've added a brief note about that to the wezterm.font docs!

Ah even better 😁 Thanks for this excellent application and your outstanding support!

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.