Skip to content

Pagination fixes & tests#18

Open
uguraslan wants to merge 1 commit into
added-pagination-and-texturesize-and-family-groupingfrom
fix/pagination-corrections
Open

Pagination fixes & tests#18
uguraslan wants to merge 1 commit into
added-pagination-and-texturesize-and-family-groupingfrom
fix/pagination-corrections

Conversation

@uguraslan
Copy link
Copy Markdown
Contributor

Fixes the multi-page atlas generation introduced in #12.

Fixes

#12 fixed the overwrite issue by adding indexed filenames, but named page 0 Font.msdf_0.png. The Blits font loader resolves atlasUrl without a suffix, so page 0 was never found and the font failed to load entirely.

Fix: page 0 keeps the unindexed name (Font.msdf.png). Extra pages use _1, _2, ... suffixes. json.pages[] is rewritten after generation to match the actual filenames on disk.

Also the renderer currently loads only page 0. Pages 1+ are generated correctly but unused until the renderer has multi-page support.

Tests

Added tests/pagination.test.js, 4 tests covering multi-page output and single-page regression. The multi-page tests force a 256×256 atlas to guarantee pagination regardless of the textureSize default.

Notes

  • Even with multi-page PNG generation working correctly, the renderer only loads page 0 today. The practical fallback is the 2048×2048 default atlas. At fontSize 42 that covers most use cases (Latin, extended Latin, Greek, Cyrillic, Hiragana, Katakana all fit comfortably on a single page).

  • Multi-page support, even when the renderer eventually adds it, won't help scripts that need a shaping engine: Arabic, Hebrew, Tamil, and similar writing systems require context-dependent glyph selection and layout that MSDF can't handle regardless of atlas size. Same applies to bidirectional text which is a renderer-level concern, not something atlas generation affects.

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