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

Texture atlas overlap in glyphs when rendering, result in ghost-boxed characters #1022

Closed
whisperity opened this issue Feb 9, 2023 · 5 comments · Fixed by #1139 or #1213
Closed

Texture atlas overlap in glyphs when rendering, result in ghost-boxed characters #1022

whisperity opened this issue Feb 9, 2023 · 5 comments · Fixed by #1139 or #1213
Labels
bug Something isn't working fonts font rasterization and text shaping API and platform implementations VT: rasterizer Rendering of the terminal into a pixmap using `terminal_renderer` library
Milestone

Comments

@whisperity
Copy link
Member

Contour Terminal version

0.3.10.4591

Installer source

Github: CI actions

Operating System

Ubuntu 20.04

Architecture

x86-64

Other Software

(Irrelevant.)

Steps to reproduce

  1. echo "%"
  2. The % looks reasonably okay, but there is a faint | at the right side:

Screenshot_20230209_101041

  1. echo "&"
  2. The "belly" of the & gets rendered into the %'s space, resulting in a broken looking glyph:

Screenshot_20230209_101110

⚠️ N.b.: This only appears on "normal" zoom level. If I do nine (9) "zoom in" actions (Ctrl + MouseWheelUp) the effect is barely noticeable:

Screenshot_20230209_101300

However, after doing another (that is, in total, ten) zoom ins, the full vertical bars come back:

Screenshot_20230209_101305

Restoring to default zoom (Ctrl+0) restores the visuals seen in step 4.zoom-ins

Expected Behavior

Characters do not expect each others' rendering.

Actual Behavior

Ugly glyphs.

Additional notes

profile:
  master:
    font:
      size: 12
      dpi_scale: 1.0
      render_mode: lcd
      regular:
        family: "JetBrainsMono Nerd Font"
[2023-02-09 10:15:19.663721] [gui.display] TerminalWindow.resizeEvent: size 200x100 (200x100)
[2023-02-09 10:15:19.670078] [gui.display] initializeGL: size=179x100, scale=1
[2023-02-09 10:15:19.670157] [gui.display] Assigning session to terminal widget: shell=/bin/zsh, terminalSize=80x24, fontSize=12pt, contentScale=1
[2023-02-09 10:15:19.710613] [gui.display] Loading vertex shader: :/contour/display/shaders/text.vert
[2023-02-09 10:15:19.713248] [gui.display] Loading fragment shader: :/contour/display/shaders/text.frag
[2023-02-09 10:15:19.714026] [gui.display] Loading vertex shader: :/contour/display/shaders/background_image.vert
[2023-02-09 10:15:19.714070] [gui.display] Loading fragment shader: :/contour/display/shaders/background_image.frag
[2023-02-09 10:15:19.714458] [gui.display] Loading vertex shader: :/contour/display/shaders/background.vert
[2023-02-09 10:15:19.714479] [gui.display] Loading fragment shader: :/contour/display/shaders/background.frag
[2023-02-09 10:15:19.715027] [gui.display] configureAtlas: 1024x2048 RGBA
[2023-02-09 10:15:19.801055] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:19.801235] [gui.display] Blur: Loading shader source :/contour/display/shaders/blur_gaussian.frag
[2023-02-09 10:15:19.802315] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:19.802400] [gui.display] Blur: Loading shader source :/contour/display/shaders/dual_kawase_up.frag
[2023-02-09 10:15:19.802958] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:19.802994] [gui.display] Blur: Loading shader source :/contour/display/shaders/dual_kawase_down.frag
[2023-02-09 10:15:19.931259] [gui.display] Blur: Gaussian run performance: 0.226s CPU.
[2023-02-09 10:15:19.943315] [gui.display] Background image from disk: 3840x2160 RGBA
[2023-02-09 10:15:19.959257] [gui.display] [FYI] Build type          : RelWithDebInfo
[2023-02-09 10:15:19.959291] [gui.display] [FYI] Application PID     : 17300
[2023-02-09 10:15:19.959293] [gui.display] [FYI] OpenGL type         : OpenGL
[2023-02-09 10:15:19.959302] [gui.display] [FYI] OpenGL renderer     : Mesa Intel(R) Xe Graphics (TGL GT2)
[2023-02-09 10:15:19.959308] [gui.display] [FYI] Qt platform         : xcb
[2023-02-09 10:15:19.959319] [gui.display] [FYI] OpenGL version      : 4.6
[2023-02-09 10:15:19.959330] [gui.display] [FYI] Content scaling     : 1
[2023-02-09 10:15:19.959336] [gui.display] [FYI] GLSL version        : 4.60 (460, 450, 440, 430, 420, 410, 400, 330, 150, 140, 130, 120, 320 es, 310 es, 300 es, 100)
[2023-02-09 10:15:19.959367] [gui.display] [FYI] Refresh rate        : 59 Hz
[2023-02-09 10:15:19.959370] [gui.display] [FYI] Screen size         : 1920x1080
[2023-02-09 10:15:19.959375] [gui.display] [FYI] Logical DPI         : 96x96
[2023-02-09 10:15:19.959383] [gui.display] [FYI] Physical DPI        : 142x141
[2023-02-09 10:15:19.959386] [gui.display] [FYI] Device pixel ratio  : 1
[2023-02-09 10:15:19.959397] [gui.display] [FYI] Content scale       : 1
[2023-02-09 10:15:19.959406] [gui.display] [FYI] Font DPI            : 96x96 (96x96)
[2023-02-09 10:15:19.959409] [gui.display] [FYI] Font size           : 12pt (16 px)
[2023-02-09 10:15:19.959411] [gui.display] [FYI] Cell size           : 10x22 px
[2023-02-09 10:15:19.959414] [gui.display] [FYI] Page size           : 80x24
[2023-02-09 10:15:19.959416] [gui.display] [FYI] Font baseline       : 5 px
[2023-02-09 10:15:19.959418] [gui.display] [FYI] Underline position  : 3 px
[2023-02-09 10:15:19.959421] [gui.display] [FYI] Underline thickness : 1 px
[2023-02-09 10:15:20.039373] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:20.039560] [gui.display] Blur: Loading shader source :/contour/display/shaders/blur_gaussian.frag
[2023-02-09 10:15:20.040294] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:20.040353] [gui.display] Blur: Loading shader source :/contour/display/shaders/dual_kawase_up.frag
[2023-02-09 10:15:20.040712] [gui.display] Blur: Loading shader source :/contour/display/shaders/simple.vert
[2023-02-09 10:15:20.040739] [gui.display] Blur: Loading shader source :/contour/display/shaders/dual_kawase_down.frag
[2023-02-09 10:15:20.139597] [gui.display] Blur: Gaussian run performance: 0.193s CPU.
[2023-02-09 10:15:20.146300] [gui.display] Background image from disk: 3840x2160 RGBA
[2023-02-09 10:15:20.160054] [gui.display] TerminalWindow.resizeEvent: size 821x528 (821x528)
[2023-02-09 10:15:20.161423] [gui.display] Resizing view to 800x528 virtual (800x528 actual).
[2023-02-09 10:15:20.161689] [gui.display] GL configure atlas: 1024x2048 RGBA GL texture Id 4
[2023-02-09 10:15:20.176440] [gui.display] Resizing view to 800x528 virtual (800x528 actual).
[2023-02-09 10:15:20.193589] [gui.display] Screen changed.

Texture atlas with only rendering %:
texture-atlas-rgba

Texture atlas after rendering the &:
texture-atlas-rgba

@whisperity whisperity added bug Something isn't working VT: rasterizer Rendering of the terminal into a pixmap using `terminal_renderer` library fonts font rasterization and text shaping API and platform implementations labels Feb 9, 2023
@whisperity whisperity added this to the 0.3.12 milestone Apr 10, 2023
@Yaraslaut
Copy link
Member

culprit is this function

void TextRenderer::restrictToTileSize(TextureAtlas::TileCreateData& tileCreateData)

Info from debug on cutting sizes

Cutting off oversized RGB tile from 11x13 down to 10x21.

@christianparpart
Copy link
Member

oh very nice catch @Yaraslaut. the question is how do we want to fix this.

we could add a 1px padding in between the texture atlas tiles. I think I have no better idea as of right now.

11x13 down to 10x21

okay, horizontally from 11 down to 10 makes sense. this might be the reason why it was triggered anyways. but 13 to 21 looks like THE bug here? hmmm 🤔

@Yaraslaut
Copy link
Member

oh very nice catch @Yaraslaut. the question is how do we want to fix this.

we could add a 1px padding in between the texture atlas tiles. I think I have no better idea as of right now.

11x13 down to 10x21

okay, horizontally from 11 down to 10 makes sense. this might be the reason why it was triggered anyways. but 13 to 21 looks like THE bug here? hmmm 🤔

I tried disabling this thing and didn't notice any changes, so I wonder why this is required in the first place? Shouldn't harfbuzz create properly aligned buffer ?

@christianparpart
Copy link
Member

you mean FreeType. yeah, but some glyphs are wider, some are tinner (horizontally and vertically). The glyphs that are horizontally wider, must be cut down to avoid accidentally writing into a tile in the texture atlas that belong to a different bitmap.

On the other hand, we have the tile splitting functionality that e.g. is used to still render programming ligatures correctly - so why do we end up cutting in that function in the first place. 🤔

@Yaraslaut
Copy link
Member

Agree, adding 1 px sound like a good idea, since i noticed that disabling this function does not solve the problem completely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fonts font rasterization and text shaping API and platform implementations VT: rasterizer Rendering of the terminal into a pixmap using `terminal_renderer` library
Projects
None yet
3 participants