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

Combining different fonts #2823

Closed okuma10 closed 1 year ago

okuma10 commented 1 year ago

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

Windows

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

None

WezTerm version

20221130-111338-8d8d7d3f

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

I might be wrong, but it appears that trying to add a different font (for Bold for example) is using the default font's glyph metrics. image

To Reproduce

No response

Configuration

local wezterm = require 'wezterm'
return {
    default_cwd = "e:/Nikola/",
    default_prog = {'C:/Program Files/PowerShell/7/pwsh.exe', '-noexit', '-command', 'cd E:/Nikola/'},
    font = wezterm.font('Iosevka NFM', {weight = 'Regular',italics = false}),
    font_rules = {
        {
            italics = false,
            intensity = 'Normal',
            font = wezterm.font('Iosevka NFM',{weight = 'Regular'})
        },
        {
            intensity = 'Bold',
            font = wezterm.font('Rubik',{weight = 'Black'}),
        },
        {
            italics = true,
            font = wezterm.font('Bonn Beta', {weight = 'Light', foreground = "#ffffff"}),
        },
    },
    adjust_window_size_when_changing_font_size = false,

    color_scheme = 'Batman',
    --[[ window_background_gradient = { ]]
    --[[    orientation = 'Horizontal', ]]
    --[[     colors = {'#EEBD89', '#D13ABD' ]]
    --[[     }, ]]
    --[[     interpolation = 'Linear', ]]
    --[[     blend = 'Rgb', ]]
    --[[ }, ]]
    colors = {
        background = '#ffffff',
        foreground = '#fb7e14',
    },
    window_background_opacity = .1,
    window_decorations = 'RESIZE',
    window_padding = {
            left = 0,
            right = -1,
            top = 0,
            bottom = 0,
    },
    window_frame = {
        --[[ active_titlebar_bg = '#ffffff', ]]
    },
}

Expected Behavior

Using different fonts to use the font's glyph metrics at that weight.

Logs

No response

Anything else?

No response

wez commented 1 year ago

Please share the output from wezterm ls-fonts

okuma10 commented 1 year ago

I apologize but where can I find these logs? I've looked up in /user/.local/share/wezterm and there is no such log file

wez commented 1 year ago

In the terminal, type wezterm ls-fonts and share the output here!

okuma10 commented 1 year ago
Primary font:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  "Iosevka NFM",

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Normal Italic=false:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  "Iosevka NFM",

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Bold:
wezterm.font_with_fallback({
  -- C:\WINDOWS\FONTS\BAHNSCHRIFT.TTF index=0 variation=5, DirectWrite
  {family="Bahnschrift", weight="Bold"},

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Half Italic=true:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  {family="Iosevka NFM", weight="Thin", style="Oblique"},

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Half Italic=false:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  {family="Iosevka NFM", weight="Thin"},

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Bold Italic=false:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  -- Will synthesize bold
  "Iosevka NFM",

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Bold Italic=true:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  -- Will synthesize bold
  {family="Iosevka NFM", style="Italic"},

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

When Intensity=Normal Italic=true:
wezterm.font_with_fallback({
  -- <imported to RAM>, Gdi
  {family="Iosevka NFM", style="Italic"},

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})

Title font:
wezterm.font_with_fallback({
  -- <built-in>, BuiltIn
  {family="Roboto", weight="Bold"},

  -- <imported to RAM>, Gdi
  "Iosevka NFM",

  -- <built-in>, BuiltIn
  "JetBrains Mono",

  -- <built-in>, BuiltIn
  -- Assumed to have Emoji Presentation
  -- Pixel sizes: [128]
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Symbols Nerd Font Mono",

})
wez commented 1 year ago

@Tony-Sol please file a separate issue of your own

wez commented 1 year ago

@okuma10 I don't think your configuration is valid; italics isn't a valid field when working with fonts or font rules. It is important to specify both italic and intensity in your font_rules to match the various combinations of bold and/or italic. https://wezfurlong.org/wezterm/config/lua/config/font_rules.html has more information about fully specifying font_rules.

I'd also suggest running wezterm ls-fonts --list-system to find potentially better matching names for the fonts you wish to use; when a font is imported from Gdi it suggests that that font isn't available via the newer font APIs in Windows, and that may be the heart of the issue that you're facing.

okuma10 commented 1 year ago

thanks

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.