Do not let Emacs rescale the grid tiles - #2
Conversation
The header image passes `:scale 1', but the grid tiles do not. So Emacs scales only the tiles, by `image-scaling-factor'. Its default is `auto', which means `char-width / 10'. With a 13px wide character that is 1.3. The header and the grid are laid out from the same `column-width', but one of them is then stretched by 30%. Every column moves further away from its day name, so the last day of the week is off by about a third of a column. Pass `:scale 1' for the tiles too. Nothing changes for anyone whose character is under 10px wide, where the factor was already 1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014nqM3DEZjQyybPRfBMwypu
|
The code looks good. Thanks. I'm wondering why is the misalignment still there in your fixed screenshot. Is this your scroll bar on the left that shifts the timegrid to the right? Also the now line doesn't appear. Not sure why that would be happening. Anyway, merging this. |
This is fixed. Emacs uses X11 colours that SVG can't always recognize. Have passed it through a convertor which now renders the colours correctly. |
|
Thanks for merging!
Yes, exactly that. The column step was already correct, so the header was shifted as a whole. That is why it looked like a small constant error and not a growing one. Opened #5 for it: it measures the gap with
Good catch on the X11 colours, and thanks for fixing it — the red line renders here now. |
The grid tiles are made with
create-imageand no:scale, but the header image passes:scale 1. So Emacs scales only the tiles, byimage-scaling-factor. Its default isauto, which meanschar-width / 10.My font is Iosevka at 19.6pt, so one character is 13px wide and the factor is 1.3.
Both the header and the grid come from the same
column-width, but then the grid is stretched by 30% and the header is not. Each column moves a bit further away from its day name.Measured on
2a03d9d(emacs -Q, empty backend, only the font set):176 / 136 = 1.29, which is the scaling factor.
With
:scale 1on the tiles, the columns are 135px and line up with the header:Note that this is not fixed by
org-timegrid-default-zoom. Your zoom makes the drawing inside the SVG bigger, andimage-scaling-factorstretches the finished image on top of that. The two just multiply.Nothing changes for users whose character is under 10px wide, because the factor was already 1 for them.
Tests: 30 pass.