Add Noto Malayalam web fonts scoped to the Malayalam script - #9
Merged
Conversation
The theme loads Source Sans Pro and PT Serif, neither of which covers Malayalam, so Malayalam runs fell back to the reader's OS font and sat visibly larger than the Latin text (reviewer feedback on #1). This adds self-hosted Google Fonts malayalam subsets of Noto Sans Malayalam (body) and Noto Serif Malayalam (headings), declared with unicode-range so only Malayalam glyphs change; Latin, digits and code keep the theme's fonts. Wired in via html_css_files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves Malayalam text rendering consistency across the site by self-hosting Malayalam-specific Noto webfonts and applying them only to the Malayalam Unicode range, avoiding OS-dependent fallback fonts with mismatched metrics.
Changes:
- Added
@font-facerules for Noto Sans/Serif Malayalam (400/700) restricted viaunicode-range, plus font-family overrides for body text and headings. - Self-hosted the corresponding
.woff2subsets under_static/fonts/and wired the stylesheet into the Sphinx build via_config.yml.
Reviewed changes
Copilot reviewed 2 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lectures/_static/malayalam-fonts.css | Defines Malayalam-scoped Noto font faces and applies them to body/headings without affecting Latin/code fonts. |
| lectures/_config.yml | Adds the new CSS file to html_css_files so it is included in the built site. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
📖 HTML build - view preview (7d76151) |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
📖 HTML build - view preview (0bb4718) |
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.
Follows up @adisankarmt's suggestion on #1 that the Malayalam script renders noticeably larger than the English, pointing at Noto Sans Malayalam.
Cause. The theme loads Source Sans Pro (body) and PT Serif (headings) from Google Fonts. Neither covers the Malayalam block, so every Malayalam run falls back to whatever the reader's OS supplies (Nirmala UI on Windows, Malayalam Sangam MN on macOS), and those fallback faces sit visibly larger than the Latin. The size difference is a property of the fallback font's metrics, not of the page's
font-size— so this is fixed by supplying a font rather than by shrinking text (which would shrink the English and code too).Change.
lectures/_static/malayalam-fonts.css—@font-facerules for Noto Sans Malayalam (body, 400/700) and Noto Serif Malayalam (headings, 400/700), each restricted withunicode-rangeto U+0D00–0D7F (+ ZWJ/ZWNJ and the dotted circle). Only Malayalam glyphs change; Latin text, digits, punctuation and code keep the theme's fonts.lectures/_static/fonts/*.woff2— the four Google Fonts "malayalam" subsets, self-hosted (~100 KB total, SIL OFL 1.1) so the edition does not depend on gstatic URLs.lectures/_config.yml—html_css_files: ['malayalam-fonts.css'].Tuning. If the Malayalam still reads large or small beside the Latin after this lands, the knob is
size-adjuston the four faces (noted in the CSS header), which scales the Malayalam glyphs alone.Review. @adisankarmt — the preview build linked below will show the new rendering; please compare against the current main site and say whether the sizing now looks right, or whether a serif face for headings is the wrong choice for Malayalam (easy to switch both to the sans).