wez / wezterm

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

Font height not consistent #2753

Closed sandikata closed 1 year ago

sandikata commented 1 year ago

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

Linux X11

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

Mutter

WezTerm version

wezterm 20221115-153845-35fd69b0

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

Font rendering is somehow wrong in order to height.

Font size 12px looks like 8-10px Compared to terminals like alacritty or gnome-terminal with 12px i have to raise font size up to 15 - 16px to match 12px on alacritty or gnome-terminal or whatever terminal

To Reproduce

Set any font to 12 and compare with another terminal with 12px font size

Configuration

local wezterm = require 'wezterm'
local act = wezterm.action

wezterm.on('update-right-status', function(window, pane)
  window:set_right_status(window:active_workspace())
end)

return {
  font = wezterm.font_with_fallback {
    -- { family = 'JetBrains Mono NL Nerd Font', weight = 'Medium' },
    { family = 'Noto Mono Nerd Font', weight = 'Medium' },
    { family = 'Terminus', weight = 'Bold' },
    'Noto Color Emoji',
  },
    font_size = 13.0,
    freetype_load_target = 'Light',
    freetype_render_target = 'HorizontalLcd',

    color_scheme_dirs = { os.getenv("HOME") .. "/.config/wezterm/colors/" },
    color_scheme = "Relaxed",

    term = "wezterm",

    -- front_end = "OpenGL",

    -- max_fps = 165,

    window_background_opacity = 0.98,

    -- initial_cols = 255,
    -- initial_rows = 50,

    scrollback_lines = 10000,

    enable_scroll_bar = true,

    use_fancy_tab_bar = true,

    tab_bar_at_bottom = true,

    window_frame = {
    -- The font used in the tab bar.
    -- Roboto Bold is the default; this font is bundled
    -- with wezterm.
    -- Whatever font is selected here, it will have the
    -- main font setting appended to it to pick up any
    -- fallback fonts you may have used there.
    font = wezterm.font { family = 'Roboto', weight = 'Bold' },

    -- The size of the font in the tab bar.
    -- Default to 10. on Windows but 12.0 on other systems
    font_size = 12.0,

    -- The overall background color of the tab bar when
    -- the window is focused
    active_titlebar_bg = '#333333',

    -- The overall background color of the tab bar when
    -- the window is not focused
    inactive_titlebar_bg = '#333333',
  },

  colors = {
    tab_bar = {
      -- The color of the inactive tab bar edge/divider
      inactive_tab_edge = '#575757',
    },
  },

  inactive_pane_hsb = {
  saturation = 0.9,
  brightness = 0.8,
  },

-- Split vertical current pane
keys = {
    -- This will create a new split and run your default program inside it
    {
      key = '"',
      mods = 'CTRL|SHIFT|ALT',
      action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
    },
  },

-- Split horizontal current pane
  keys = {
    -- This will create a new split and run your default program inside it
    {
      key = '%',
      mods = 'CTRL|SHIFT|ALT',
      action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
    },
  },

-- Zoom pane
    keys = {
    {
      key = 'Z',
      mods = 'CTRL|SHIFT',
      action = wezterm.action.TogglePaneZoomState,
    },
  },

-- Mouse cursor
  default_cursor_style = 'BlinkingUnderline',
  cursor_blink_rate = 300,

-- Visual Bell Screen Blink
  visual_bell = {
    fade_in_function = 'EaseIn',
    fade_in_duration_ms = 150,
    fade_out_function = 'EaseOut',
    fade_out_duration_ms = 150,
  },
  colors = {
    visual_bell = '#202020',
  },

-- Visual Bell Mouse Flare
--   visual_bell = {
--    fade_in_duration_ms = 75,
--    fade_out_duration_ms = 75,
--    target = 'CursorColor',
--  },

  keys = {
    {
      key = '0',
      mods = 'CTRL',
      action = wezterm.action.ResetFontAndWindowSize,
    },
  },
}

Expected Behavior

fonts to be properly rendered

Logs

No response

Anything else?

No response

wez commented 1 year ago

The font size is measured in points not pixels. Using points allows the text size to remain consistent when wezterm windows are shown on monitors with different pixel densities.

The pixel size is computed using the dpi of your display:

$$ pixelheight = {fontsize * dpi \over 72} $$

Note that if you are using a bitmap font, then wezterm will use the closest available pixel strike to the computed pixel height, because bitmap fonts are not scalable.

See also:

sandikata commented 1 year ago

well, i am using Noto Fonts.

So,

fontsize=12 * dpi=96 (default)

изображение

But it doesn't seems to match it.

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.