mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-27 03:27:21 -06:00
#260 (page 9) reports text that looks softer than in Acrobat once zoomed. The page was rendered at the zoom's device scale rounded to 1/64 (render_scale, to spare re-renders on tiny fit-width changes), and the texture was stretched onto the page's layout rectangle, whose corner usually isn't on a whole physical pixel. Every line and glyph went through linear resampling: at 87 % on a 2x display the raster was 0.32 % too small for its rectangle, and #260's page 9 lost 7.9 % sharpness against a direct render (1.7 % at 137 %; 0 at 150 %, which happens to quantize exactly). The page now renders at the exact device scale (tags resolve 1/65536 of a scale step instead of 1/1000), each page rectangle starts on a whole physical pixel, and a raster at the current scale is drawn at its own pixel size from there, whole page or tile. A raster from an older scale (mid-zoom) and the low-resolution backdrop under tiles still stretch, as before. With the fix, page 9 on screen matches a direct render exactly (mean difference 0.00/255 at 87 % and 137 %, was 6.30 and 2.66). Test: view.rs::page_raster_maps_one_to_one_onto_screen_pixels renders a page of 0.5 pt lines at 87 % with 1 and 2 pixels per point and compares the screen with the page rendered directly at the exact scale. On main: mean difference 69.5/255, max 216. Now: under 1, max under 16. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>