Skip to content

Add Noto Malayalam web fonts scoped to the Malayalam script - #9

Merged
mmcky merged 2 commits into
mainfrom
malayalam-webfont
Aug 20, 2026
Merged

Add Noto Malayalam web fonts scoped to the Malayalam script#9
mmcky merged 2 commits into
mainfrom
malayalam-webfont

Conversation

@mmcky

@mmcky mmcky commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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-face rules for Noto Sans Malayalam (body, 400/700) and Noto Serif Malayalam (headings, 400/700), each restricted with unicode-range to 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.ymlhtml_css_files: ['malayalam-fonts.css'].

Tuning. If the Malayalam still reads large or small beside the Latin after this lands, the knob is size-adjust on 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).

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-face rules for Noto Sans/Serif Malayalam (400/700) restricted via unicode-range, plus font-family overrides for body text and headings.
  • Self-hosted the corresponding .woff2 subsets 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.

Comment thread lectures/_static/malayalam-fonts.css Outdated
@github-actions

Copy link
Copy Markdown
Contributor

📖 HTML build - view preview (7d76151)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📖 HTML build - view preview (0bb4718)

@mmcky
mmcky merged commit 37a22cd into main Aug 20, 2026
4 checks passed
@mmcky
mmcky deleted the malayalam-webfont branch August 20, 2026 23:56
github-actions Bot added a commit that referenced this pull request Aug 20, 2026
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.

2 participants