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

Terminal font alignment regression when GPU acceleration used #204591

Closed
jryans opened this issue Feb 7, 2024 · 5 comments
Closed

Terminal font alignment regression when GPU acceleration used #204591

jryans opened this issue Feb 7, 2024 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) terminal-rendering upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Milestone

Comments

@jryans
Copy link

jryans commented Feb 7, 2024

Type: Bug

VS Code 1.86 seems to have regressed terminal font alignment compared to 1.85 for me. When terminal GPU acceleration is used, the terminal text is placed slightly lower than expected and the cursor is taller than expected.

Context

  • macOS 13.6.4
  • Terminal font: Source Code Pro
All terminal-related settings
  "terminal.integrated.fontFamily": "Source Code Pro",
  "terminal.integrated.fontSize": 14,
  "workbench.colorCustomizations": {
    "terminal.background": "#1D1F21",
    "terminal.foreground": "#C5C8C6",
    "terminalCursor.background": "#C5C8C6",
    "terminalCursor.foreground": "#C5C8C6",
    "terminal.ansiBlack": "#1D1F21",
    "terminal.ansiBlue": "#86aec0",
    "terminal.ansiCyan": "#92bfb8",
    "terminal.ansiGreen": "#a5b474",
    "terminal.ansiMagenta": "#b28dad",
    "terminal.ansiRed": "#b05c57",
    "terminal.ansiWhite": "#C5C8C6",
    "terminal.ansiYellow": "#f0cb91",
    "terminal.ansiBrightBlack": "#969896",
    "terminal.ansiBrightBlue": "#86aec0",
    "terminal.ansiBrightCyan": "#92bfb8",
    "terminal.ansiBrightGreen": "#a5b474",
    "terminal.ansiBrightMagenta": "#b28dad",
    "terminal.ansiBrightRed": "#b05c57",
    "terminal.ansiBrightWhite": "#FFFFFF",
    "terminal.ansiBrightYellow": "#f0cb91",
  },
  "terminal.integrated.tabs.enabled": false,
  "terminal.integrated.copyOnSelection": true,
  "terminal.integrated.minimumContrastRatio": 1,
  "terminal.integrated.scrollback": 10000,
  "terminal.integrated.persistentSessionScrollback": 1000,
  "terminal.integrated.shellIntegration.enabled": false,
  "terminal.integrated.shellIntegration.decorationsEnabled": "never",

With terminal acceleration

terminal.integrated.gpuAcceleration: auto

This is the default acceleration value and what I normally use, but it produces bad font metrics in 1.86 for me:

2024-02-07 at 11 54

In particular, the text is placed too low and the descenders of letters like "j" and "g" on the last line are cut off. Also, notice that the top of cursor block sticks out quite high and pokes up into the line above.

Without terminal acceleration

terminal.integrated.gpuAcceleration: off

With GPU acceleration off, the text metrics look correct to me:

2024-02-07 at 12 02

All descenders on the last line are visible, and the cursor block is vertically aligned with the current line of text.

VS Code version: Code 1.86.0 (0504748, 2024-01-31T10:29:15.765Z)
OS version: Darwin x64 22.6.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 6, 4, 4
Memory (System) 32.00GB (0.25GB free)
Process Argv --crash-reporter-id f154a3a4-d518-4bd8-a55f-e21f7dcfdcd2
Screen Reader no
VM 0%
Extensions (45)
Extension Author (truncated) Version
language-x86-64-assembly 13x 3.1.4
vscode-ron a5h 0.11.0
chez-scheme-vscode abh 0.1.4
mercury bre 0.0.1
autotrim chr 1.1.1
vscode-eslint dba 2.4.2
xml Dot 2.5.1
vscode-wasm dts 1.4.1
gitlens eam 14.5.0
magic-racket evz 0.6.6
rest-client hum 0.25.1
latex-workshop Jam 9.15.7
svg joc 1.5.3
llvm jry 0.0.1
vsc-fennel kon 0.1.3
beancount Len 0.10.0
mercury-ls lil 0.0.8
vscode-mlir llv 0.0.11
autoconf mae 0.2.0
Kotlin mat 1.7.1
file-downloader min 1.0.13
isort ms- 2023.10.1
python ms- 2023.20.0
vscode-pylance ms- 2023.11.13
jupyter ms- 2023.10.1100000000
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.17
vscode-jupyter-cell-tags ms- 0.1.8
vscode-jupyter-slideshow ms- 0.1.5
cpptools ms- 1.18.5
hexeditor ms- 1.9.12
vscode-json-editor nic 0.3.0
vscode-yaml red 1.14.0
rust-analyzer rus 0.3.1730
partial-diff ryu 1.4.3
dot Ste 0.0.1
rewrap stk 1.16.3
code-spell-checker str 3.0.1
even-better-toml tam 0.19.2
open-in-browser tec 2.0.0
graphviz-interactive-preview tin 0.3.5
latex-support tor 3.10.0
cmake twx 0.0.17
vim vsc 1.27.0
markdown-all-in-one yzh 3.5.1

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30951796
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019b:30953937
3ef8e399:30949928
bg6jg535:30956215

@jryans
Copy link
Author

jryans commented Feb 8, 2024

In case it's relevant here, my default external monitor is a low DPI / non-retina monitor (devicePixelRatio == 1).

@jryans
Copy link
Author

jryans commented Feb 8, 2024

Just retested with the internal retina monitor, looks the same there, so I guess that's not a factor here.

@towo
Copy link

towo commented Feb 26, 2024

Same here, w/ Arch Linux and Ubuntu 22.04 and e.g. "SauceCodePro Nerd Font", native and via Citrix.
As a weird side effect, the angled brackets of the prompt are correctly aligned when using "terminal.integrated.customGlyphs": true, and not so when false. Sample attached.

Screenshot from 2024-02-26 16-21-22
Screenshot from 2024-02-26 16-21-01
Screenshot from 2024-02-26 16-20-37

@Tyriar Tyriar added this to the Backlog milestone Feb 26, 2024
@Tyriar Tyriar added upstream Issue identified as 'upstream' component related (exists outside of VS Code) bug Issue identified by VS Code Team member as probable bug and removed confirmation-pending labels Dec 10, 2024
@Tyriar
Copy link
Member

Tyriar commented Dec 10, 2024

We've always had a problem with Linux in particular about certain fonts not giving us the right font metrics AFAICT. Source Code Pro on mac seems to have the same problem. To look into this we should try reproduce it and look into the text metrics/bounding box/origin being calaculated in xterm.js

@Tyriar
Copy link
Member

Tyriar commented Dec 19, 2024

Tracking upstream: xtermjs/xterm.js#5257

@Tyriar Tyriar closed this as completed Dec 19, 2024
@Tyriar Tyriar added the *duplicate Issue identified as a duplicate of another issue(s) label Dec 19, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Feb 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) terminal-rendering upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

5 participants