Skip to content

Conversation

@tomer-gom
Copy link

@tomer-gom tomer-gom commented Dec 5, 2025

Summary

Currently Tibetan isn't rendered properly, characters aren't stacking as they are supposed to. This is because the font used doesn't support Tibetan script stacking. This PR addresses that.

  • Add a Tibetan font fallback (local-only, unicode-range: U+0F00-0FFF) so Tibetan text stacks correctly without bundling fonts.
  • Load that fallback once after /theme/current so it wins over the theme’s body font but still respects user custom styles.
  • Preserve each theme’s typography by setting --lute-theme-font-stack to match its existing font stack; To keep each theme’s typography intact (and avoid falling back to the base stack), each theme needed to set --lute-theme-font-stack to match its existing font choices. That way, the new fallback can prepend Tibetan-capable fonts while preserving the look each theme already defined for non-Tibetan text.
  • Include the fallback CSS on all pages (reader, term popup, term sentences, image search) so term-related views get the same Tibetan rendering.

Testing

  • Manual: verified Tibetan text stacks in reader, title, term popup/selector, sentences.
  • Manual: confirmed script-fallbacks.css loads after /theme/current on those pages.
  • Manual negative checks: temporarily broke the Tibetan stack and the theme fallback to ensure the Playwright assertions fail when expected.
  • Automated: created pytest tests/playwright/test_tibetan_font.py (with app running on :5001) passes when fallbacks are correct and fails under the simulated breakages (simulated Tibetan text using not supported font, and simulated non-Tibetan text overriden with Tibetan font instead of theme font)

Before (Characters not stacking properly)
Screenshot 2025-12-06 at 0 13 25
After (Correct character stacking)
Screenshot 2025-12-06 at 0 13 02

This change adds sentence.SeTextLC.  The field is set to '*' if lowercasing the SeText using
the Language.parser returns the same value from sqlite's built-in LOWER function.  This
special character ends up saving many mb of file size in my db, as 99.95% of the sentences
can be downcased with sqlite when searching for references.

Also adds a data cleanup job for users upgrading from prior version.
@tomer-gom tomer-gom changed the base branch from master to develop December 5, 2025 18:50
@tomer-gom tomer-gom force-pushed the fix/tibetan_renders_properly branch from 7c962cb to 67dd8c3 Compare December 20, 2025 17:41
@tomer-gom tomer-gom force-pushed the fix/tibetan_renders_properly branch from 67dd8c3 to 6c76810 Compare December 20, 2025 17:54
@tomer-gom tomer-gom closed this Dec 20, 2025
@tomer-gom
Copy link
Author

tomer-gom commented Dec 20, 2025

Opened new pr - #647

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.

4 participants