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

Text is abnormally thin when setting allowTransparency=true with webgl renderer (even when color is opaque) #4212

Open
JasonXJ opened this issue Oct 18, 2022 · 3 comments
Labels

Comments

@JasonXJ
Copy link

JasonXJ commented Oct 18, 2022

Text rendering is abnormally thin when allowTransparency=true with the webgl renderer even when the background color is completely opaque.

allowTransparency=false: disallow_transparency

allowTransparency=true: allow_transparency

I think this is also mentioned in this comment in another bug.

Details

  • Browser and browser version: Chrome 106.0.5249.119
  • OS version: Linux (Debian)
  • xterm.js version: ToT @ 376f0d9

Steps to reproduce

  1. Run the demo page
  2. Set theme to light and font family to "Noto Sans Mono"
  3. Execute echo -e '\033[33mhello world\033[m'
  4. Observe that the rendering is OK
  5. Check the "allowTransparency" toggle
  6. Reload the webgl addon because the rendering is messed up: Uncheck and then check the webgl checkbox under "Addon". (I believe reloading the addon is NOT what is causing problem here)
  7. Observe that the "hello world" text is abnormally thin

Note that the light theme have a completely opaque background, so the rendering theoretically should just be the same.

@Tyriar
Copy link
Member

Tyriar commented Oct 18, 2022

I thought maybe this was the clear threshold stuff not playing nice with allowTransparency but I think we disable it completely there 🤔

// Clear out the background color and determine if the glyph is empty.
let isEmpty: boolean;
if (!this._config.allowTransparency) {
isEmpty = clearColor(imageData, backgroundColor, foregroundColor, enableClearThresholdCheck);
} else {
isEmpty = checkCompletelyTransparent(imageData);
}

@Tyriar Tyriar added this to the 5.1.0 milestone Oct 18, 2022
@Tyriar Tyriar added type/bug Something is misbehaving area/addon/webgl labels Oct 18, 2022
@biberklatsche
Copy link

biberklatsche commented Oct 26, 2022

Hi @Tyriar,
I have the same problem, but I found a workaround. Maybe this helps to fix the problem.

If I bind XTerm to an html element, load the WebglAddon, remove this element and bind it again to another element, the text is rendered correctly.

    const terminal = new Terminal(...)
    const div = document.createElement('div1');
    document.body.append(div1);
    terminal.open(div1);
    terminal.loadAddon(new WebglAddon())
    document.body.removeChild(div1);
    const div2 = document.createElement('div2');
    terminal.open(div2);

OS: Windows 10
XTerm: 5.0.0
WebGL-Addon: 0.13.0
Browser: Chromium 102.0.5005.61

@biberklatsche
Copy link

Hi @Tyriar, I have the same problem, but I found a workaround. Maybe this helps to fix the problem.

If I bind XTerm to an html element, load the WebglAddon, remove this element and bind it again to another element, the text is rendered correctly.

    const terminal = new Terminal(...)
    const div = document.createElement('div1');
    document.body.append(div1);
    terminal.open(div1);
    terminal.loadAddon(new WebglAddon())
    document.body.removeChild(div1);
    const div2 = document.createElement('div2');
    terminal.open(div2);

OS: Windows 10 XTerm: 5.0.0 WebGL-Addon: 0.13.0 Browser: Chromium 102.0.5005.61

Ahh, I noticed that in that case the DomRenderer is used and not the WebglRenderer. 🤦‍♂️🤦‍♂️🤦‍♂️

@Tyriar Tyriar removed this from the 5.1.0 milestone Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants