wez / wezterm

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

font larger than on other terminals #332

Closed erf closed 3 years ago

erf commented 4 years ago

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):

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.

wez commented 3 years ago

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.

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.