Wezterm: font larger than on other terminals

Created on 16 Nov 2020  路  1Comment  路  Source: wez/wezterm

Describe the bug

In the .wezterm.lua config file, i set font_size = 13.0, but compared to other terminals like iTerm2 or the Terminal app, the font is larger, similar to if it was set to 15-16 on the other Terminals.

According to my screen on a Macbook Pro 13" 2017 with resolution of 2560x1600, dpi should be 226.0, but if i change it to that, the font is VERY large. However if i change it to about 74 it looks about right compared to the other terminals.

I saw in the docs you state that "DPI is not automatically probed", so is this the expected behaviour?

I'm i using the wrong dpi value?

Maybe because of the retina screen the dpi should be set to 226/3=75.33 which is close to the number i 74 i tried? Not sure how these retina screens work. Will look into it.

Maybe the dpi should be set to the PPD on macs see this?

Environment (please complete the following information):

  • OS: macOS 11.0.1 (20B29) ( was similar on previous version )
  • Version: wezterm 20201101-103216-403d002d-29-g0bb02ff6

To Reproduce

Set a font_size = 13 in .wezterm.lua, then open another Terminal like iTerm2 with the same font size and observe that the font size is larger on Wezterm.

Configuration

local wezterm = require 'wezterm'

return {
    -- dpi = 74.0, -- looks similar with this dpi on a Macbook Pro 13" 2017
    font_size = 13.0,
    font = wezterm.font("Fira Code"),
}

Expected behavior

Optimally the font size would be the same as on other terminals by default, but since dpi is "not automatically probed" as described in the docs, i would expect it to work with dpi set to 226 on my machine.

bug macOS

Most helpful comment

Reading around a bit (https://wiki.lazarus.freepascal.org/Cocoa_DPI), it appears that 72.0 is the base value used by Cocoa; that number is significant because it is a constant factor in the points->pixels conversion function (pixels = point_size * dpi / 72), so having dpi==72 means that points==pixels.

I've pushed a commit that makes the default dpi==72 on macOS; with that set, a 10 point font in Terminal.app and WezTerm.app appear about the same size to me on a Retina macbook.

>All comments

Reading around a bit (https://wiki.lazarus.freepascal.org/Cocoa_DPI), it appears that 72.0 is the base value used by Cocoa; that number is significant because it is a constant factor in the points->pixels conversion function (pixels = point_size * dpi / 72), so having dpi==72 means that points==pixels.

I've pushed a commit that makes the default dpi==72 on macOS; with that set, a 10 point font in Terminal.app and WezTerm.app appear about the same size to me on a Retina macbook.

Was this page helpful?
0 / 5 - 0 ratings