Skip to content

Display density changes lead to corrupted characters #2137

Closed

Description

@Eugeny

When switching between a built-in Retina display and an external normal-density display, some characters will be drawn with incorrect size by the canvas renderer.

Now, I can't confirm whether it's possibly Electron's fault, but I suspect that Chrome would behave the same.

xterm 3.13.2

image

Activity

  1. Tyriar commented on May 28, 2019

    @Tyriar
    Member

    Might be rel;ated to ligature problems in #2135?

  2. Eugeny commented on May 28, 2019

    @Eugeny
    MemberAuthor

    Might be, but I don't think so. Looks like some chars might be cached in the renderer atlas with a smaller resolution?

  3. Tyriar commented on May 28, 2019

    @Tyriar
    Member

    @Eugeny seems to me like the cached parts are -r, -x and --.

  4. Eugeny commented on May 28, 2019

    @Eugeny
    MemberAuthor

    Good point - these are the ones that are incorrectly rendered in #2135

  5. Eugeny commented on May 28, 2019

    @Eugeny
    MemberAuthor

    Weirdly enough, switching to a higher density makes these characters larger, and switching to a smaller density display makes them smaller.

  6. Tyriar commented on May 28, 2019

    @Tyriar
    Member

    The APIs that https://github.com/xtermjs/xterm-addon-ligatures use probably just need some updating for the recent updates to renderers.

  7. jerch commented on May 28, 2019

    @jerch
    Member

    Cannot repro this and the other issue #2135 (on Ubuntu though, with Fira Mono and ligatures enabled).
    Kinda sounds as the dpr change gets not applied? @Eugeny Could you test, if the demo shows the same wrongly scaled glyphs when you switch the screens?

  8. Eugeny commented on Jun 25, 2019

    @Eugeny
    MemberAuthor

    Still reliably reproducible in master with the webgl renderer:
    image

    The font doesn't get corrupted immediately after the DPI switch, but rather after font-family and font-size are updated (re-set to the same values) in xterm.

  9. yuezk commented on Apr 20, 2020

    @yuezk

    @jerch @Tyriar
    I came from the VS Code issue microsoft/vscode#94656
    It can be reliably reproduced reliably on my macOS 10.15.3 with VS Code 1.44.2 and enabled the experimentalWebgl renderer type.

    image

    I have two displays show below
    image

    1. Keep the external display connected.
    2. Open the Terminal if it hasn't been.
    3. Move the VS Code to the external display if it hasn't been.
      image
    4. Disconnect the external display.
    5. The VS Code will be moved to the builtin display automatically.
    6. The Terminal font corrupted.
      image
  10. Tyriar commented on Apr 20, 2020

    @Tyriar
    Member

    I've seen this happen a bunch, we're probably just missing a case in https://github.com/xtermjs/xterm.js/blob/master/src/browser/ScreenDprMonitor.ts, or something is not listening to the monitor.

  11. Eugeny commented on May 2, 2020

    @Eugeny
    MemberAuthor

    @Tyriar in case this helps, it can be reliably reproduced with the demo page, but only for unicode characters. ASCII will get occasionally corrupted, but not always.

    Changing font size to something else and back immediately fixes it.

  12. jerch commented on May 2, 2020

    @jerch
    Member

    @Eugeny Could you test if this can be repro'ed for ASCII as well, if the fg color is set to RGB?

    I suspect that _drawUncachedChars does not get the DPR changes for some reason.

  13. Eugeny commented on May 2, 2020

    @Eugeny
    MemberAuthor

    @jerch I've just pushed a PR with the fix. The listener wasn't being called at all.

  14. added this to the 4.6.0 milestone on May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址