You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Render at the terminal's real cell pixel size (DPI-aware), with fonts sized to match #18
The canvas is cols*16 × rows*32 px. That's about 1× on a Retina Mac (a cell is about 16×34 device px), so the terminal stretches the image a little.
The code comment claims "2x supersample", which is wrong.
MAX_PIXELS = 2M (only needed for chafa's WASM) pushes large iTerm2 charts below 1×. For example 200×50 cells becomes 2000×1000 px, which is 10×20 px per cell.
renderer.ts sets fontPx = max(10, height/40), so axis labels are about ⅓ of a cell tall, while terminal text is about 0.7 of a cell. Line widths are tripled as a separate workaround.
Proposed fix:
Get the cell size in pixels with CSI 16 t (reply CSI 6;h;w t, supported by kitty, iTerm2, WezTerm, foot and ghostty; check xterm.js). Read the reply before Ink attaches its stdin parser, or it leaks into the app's input like the kitty replies did (Fix kitty reply leak, inline-image cleanup, cursor handling and kitty image IDs #15). Alternatively accept a cellPixelSize/devicePixelRatio prop, with a sensible default of 2 on macOS.
Render at exactly cols*cellW × rows*cellH device pixels so the terminal doesn't resample.
Let uPlot do the scaling. Set the DOM shim's devicePixelRatiobefore the first import('uplot'): uPlot reads pxRatio once at import, and the shim never fires dppxchange. Then pass CSS-pixel width and height. That replaces the height/40 and width*3 workarounds.
Drop MAX_PIXELS for the PNG path and keep a sane MAX_DIM.
Activity