Skip to content

Increase MathJax PNG resolution while preserving equation size - #76

Merged
Divide-By-0 merged 1 commit into
masterfrom
stack/03-mathjax-resolution
Sep 29, 2026
Merged

Divide-By-0 merged 1 commit into
masterfrom
stack/03-mathjax-resolution

Conversation

@Divide-By-0

Copy link
Copy Markdown
Owner

MathJax PNGs were rasterized at 5x and looked softer than the high-resolution CodeCogs output. Render at 12x for 2.4x more pixels per dimension, and pass the actual scale back to Docs/Slides so equation size and surrounding text spacing stay unchanged.

Human intent

Change

  • Negotiate scale support: new server/new sidebar uses 12x; new sidebar/old server stays 5x; old sidebar/new server defaults 5x. Metadata is set only after PNG export succeeds.
  • Cap canvases at 4096 pixels per side and 8 million pixels. Oversized equations use a smaller reported scale to preserve layout; legacy servers fail safely if their fixed 5x output exceeds the budget.
  • Keep Docs image sizes and Slides image widths/space counts unchanged. Existing rendered images are unaffected until re-rendered.

Validation

  • Before patch, two focused tests fail: a 100x20 layout produces 500x100 instead of 1200x240, and a large equation exceeds the pixel budget. A debugger breakpoint confirms the old canvas dimensions.
  • The real Chromium regression also fails with the unchanged renderer (scale 5 instead of 12).
  • Eight focused tests now pass; 167 total tests pass, along with Docs/Slides sidebar builds and the 40-setting/256-PNG browser matrix.
  • Real PNG comparison: angle 270x40 → 648x96; three-row cases 430x190 → 1032x456. Normalized display dimensions are unchanged. Host insertion APIs are mocked; production Google insertion remains a deployment smoke check.

Stacked on #75. No merge or deployment. Docs/Slides server and rebuilt sidebars carry the change; Common changes here are types only. Sheets has no MathJax client path. Higher raster density does not make MathJax and CodeCogs fonts identical or guarantee an exact physical DPI after Google resizes images. Tracks AGENTS-250.

Base automatically changed from stack/02-codecogs-dpi to master September 29, 2026 01:33
@Divide-By-0
Divide-By-0 merged commit 82df915 into master Sep 29, 2026
3 checks passed
@Divide-By-0
Divide-By-0 deleted the stack/03-mathjax-resolution branch September 29, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant