Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font rendering on external monitor is not correct (macOS) #3575

Open
asapkep opened this issue Apr 21, 2023 · 3 comments
Open

Font rendering on external monitor is not correct (macOS) #3575

asapkep opened this issue Apr 21, 2023 · 3 comments
Labels
bug Something isn't working macOS Issue applies to Apple macOS

Comments

@asapkep
Copy link

asapkep commented Apr 21, 2023

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

macOS

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

No response

WezTerm version

wezterm 20230420-215209-70d809fa

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 configuring wezterm to utilize MonoLisa nerd font, the font rendering on an external 1920x1080 display is not correct. When moving the terminal window back to M1 retina display, the font issue disappears. My wezterm.lua config is very basic and only has lines for font size and font currently.

The first screenshot illustrates the issue:
Screenshot 2023-04-21 at 11 27 08 AM

The following screenshot shows the issue disappearing when on native macbook screen:
Screenshot 2023-04-21 at 11 27 38 AM

The issue doesn't occur with the default font however. The issue also doesn't arise on other emulators like Kitty.

To Reproduce

On an external display utilizing the MonoLisa font.

Configuration

local wezterm = require("wezterm")

return {
font = wezterm.font("MonoLisa Nerd Font Mono"),
font_size = 14,
}

Expected Behavior

The font "crispness" should be consistent between the two monitors

Logs

No response

Anything else?

No response

@asapkep asapkep added the bug Something isn't working label Apr 21, 2023
@wez
Copy link
Owner

wez commented Apr 21, 2023

If you resize the window, does it get sharper?

Please open the debug overlay (CTRL-SHIFT-L) and then input:

> wezterm.gui.screens()

and share the output

What resolution/scaling do you have configured for that display in the macOS display settings?

@wez wez added the waiting-on-op Waiting for more information from the original poster label Apr 21, 2023
@github-actions github-actions bot removed the waiting-on-op Waiting for more information from the original poster label Apr 22, 2023
@asapkep
Copy link
Author

asapkep commented Apr 22, 2023

If you resize the window, does it get sharper?

Please open the debug overlay (CTRL-SHIFT-L) and then input:

> wezterm.gui.screens()

and share the output

What resolution/scaling do you have configured for that display in the macOS display settings?

Resizing the window doesn't have any effect on the font rendering, unfortunately. Making the window larger gives me more room to read but the font size stays the same and so no effect.

The output of the above-mentioned command is:

{
    "active": {
        "height": 1080,
        "max_fps": 75,
        "name": "K273",
        "scale": 1,
        "width": 1920,
        "x": 1800,
        "y": 89,
    },
    "by_name": {
        "Built-in Retina Display": {
            "height": 2338,
            "max_fps": 120,
            "name": "Built-in Retina Display",
            "scale": 1,
            "width": 3600,
            "x": 0,
            "y": 0,
        },
        "K273": {
            "height": 1080,
            "max_fps": 75,
            "name": "K273",
            "scale": 1,
            "width": 1920,
            "x": 1800,
            "y": 89,
        },
    },
    "main": {
        "height": 2338,
        "max_fps": 120,
        "name": "Built-in Retina Display",
        "scale": 1,
        "width": 3600,
        "x": 0,
        "y": 0,
    },
    "origin_x": 0,
    "origin_y": 0,
    "virtual_height": 2338,
    "virtual_width": 3720,
}

I have the default resolution for the 14 in M1 pro with the scaling set to "more space". From the output of the command you mentioned, it looks like the scale is set to 1 for both monitors.

I have tried adding the dpi flag within the config based on your documentation (96 and 144 I believe) and although this fixes the issue I notice that the font itself is not mono. For example, there is noticeable space between the e and t in wezterm (kind of like we zterm although its not as extreme as how it looks here in my example)

EDIT: The issue is not local to neovim but rather all text within the terminal.

@wez wez added the macOS Issue applies to Apple macOS label Feb 4, 2024
wez added a commit that referenced this issue Feb 7, 2024
There are a number of open issues that relate to getting the dpi
wrong when spawning a window. In theory it shouldn't matter because
we will immediately realize the difference and synthesize the correct
information, but evidence shows this isn't quite true.

What this commit does is:

* Override Connection::default_dpi() on macOS to return the
  effective_dpi from the active screen instead of the default
  non-retina dpi
* Adjust the Config::initial_size() method to accept an optional
  cell pixel dimension
* Add a helper function to wezterm-gui to compute the cell pixel
  dimensions given the config and the (usually default) dpi, and
  feed that through to Config::initial_size
* in the macos window impl, scale the computed geometry based on
  the ratio of the Connection::default_dpi and the default non-retina
  dpi.

This helps to avoid needing to do a fixup in the
#4966 case, and may help with
the various other macos quirky issues.

refs: #2958
refs: #3575
refs: #3900
refs: #4250
refs: #4285
refs: #4447
refs: #4851
refs: #4966
@wez
Copy link
Owner

wez commented Feb 8, 2024

Please try the latest nightly build and let me know if this is still an issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS Issue applies to Apple macOS
Projects
None yet
Development

No branches or pull requests

2 participants