Pagination fixes & tests#18
Open
uguraslan wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 resolvesatlasUrlwithout a suffix, so page 0 was never found and the font failed to load entirely.Fix:
page 0keeps 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 a256×256atlas to guarantee pagination regardless of thetextureSizedefault.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.