Skip to content

Add Vedic mark rendering prototype for Baloo Tammudu 2 (Telugu)#16

Open
revurpk wants to merge 2 commits into
EkType:masterfrom
revurpk:vedic
Open

Add Vedic mark rendering prototype for Baloo Tammudu 2 (Telugu)#16
revurpk wants to merge 2 commits into
EkType:masterfrom
revurpk:vedic

Conversation

@revurpk

@revurpk revurpk commented May 24, 2026

Copy link
Copy Markdown

This is a prototype for review generated using Claude Code, not a merge-ready implementation. The TODO list in the README captures what's still needed.

Adds rendering support for Vedic accent marks to all five weights of Baloo Tammudu 2 by grafting outlines from Noto Sans Devanagari (OFL) into the released TTX artefacts, then wiring proper OpenType layout.

Codepoints covered (45 total):

  • U+0951-U+0954 Devanagari Vedic accents (udatta, anudatta, grave, acute) - widely used in Telugu Sanskrit prosody
  • U+1CD0-U+1CFF Unicode Vedic Extensions block (41/48 assigned; gaps are Unicode 12/13 additions or unassigned codepoints that the donor does not have either)

Implementation

vedic-build/graft_vedic.py

  • Flattens donor composites via DecomposingRecordingPen.
  • Adapts geometry: above-marks have bbox-bottom aligned to Y=600 (Baloos existing mark band); all marks centered at X=-300 so they land over a typical Telugu base under static positioning.
  • Sets zero advance width, GDEF class 3 (mark), and adds cmap entries on the Windows BMP subtable.

vedic-build/add_vedic_gpos.py

  • Adds a new GPOS lookup (type 4, MarkBasePos) with anchors on 74 Telugu consonants (top-center at ymax + 220) and 27 Vedic above-marks (bottom-center at ymin).
  • Excludes above-base matras and halant from the base coverage so the mark attaches to the consonant directly rather than to a matras off-center bbox.
  • Registers a new abvm feature on the tel2 and telu scripts.

Build pipeline

TTX -> intermediate TTF (via fontTools.ttx)
-> patched TTF (via graft_vedic.py)
-> patched TTF (via add_vedic_gpos.py adds GPOS)

The five patched TTFs land in BalooTammudu2-Telugu/vedic-build/ and are gitignored (covered by repo-wide *.ttf rule); regenerate with the pipeline documented in vedic-build/README.md.

Scope and caveats

This is a non-authoritative prototype. The .vfb sources in BalooTammudu2-Telugu/*/VFB/ are unchanged. A feature request tracking the proper work has been filed at github.com/EkType/Baloo2/issues.

Limitations of the graft:

  • Style mismatch: Notos stroke contrast differs from Baloos.
  • Only above-marks get GPOS anchors; below-marks (U+0952 anudatta and a few in Vedic Extensions) rely on static positioning.
  • Tall above-base matras like matraIi come within ~80 units of the marks; tune BASE_ANCHOR_Y_GAP in add_vedic_gpos.py for more clearance.

TODO for the proper fix (full list in vedic-build/README.md):

  • Draw native Vedic glyphs in FontLab matched to Baloos display style, in all five weights. This is the blocker.
  • Add GlyphOrderAndAliasDB and GDEF entries for the new glyphs.
  • Design real GPOS anchors (above and below) in the .vfb sources rather than the heuristic this prototype uses.
  • Handle above-base matras via mkmk anchors or contextual GPOS instead of the current exclude-from-coverage workaround.
  • Register abvm/blwm features in the source feature tables so the fix survives the next VFB->TTF rebuild (this prototype patches GPOS at the TTF level only).
  • Cover the seven gaps the donor lacks (U+1CF7, U+1CFA).
  • Visual QA across a Vedic test corpus.
  • Remove vedic-build/ once proper sources ship.

Files changed

OFL.txt Noto attribution per OFL S4
BalooTammudu2-Telugu/vedic-build/.gitignore Skip donor tree, ephemera
BalooTammudu2-Telugu/vedic-build/README.md Pipeline, caveats, TODO
BalooTammudu2-Telugu/vedic-build/graft_vedic.py
BalooTammudu2-Telugu/vedic-build/add_vedic_gpos.py

Adds rendering support for Vedic accent marks to all five weights of
Baloo Tammudu 2 by grafting outlines from Noto Sans Devanagari (OFL)
into the released TTX artefacts, then wiring proper OpenType layout.

Codepoints covered (45 total):
  - U+0951-U+0954  Devanagari Vedic accents (udatta, anudatta,
                   grave, acute) - widely used in Telugu Sanskrit
                   prosody
  - U+1CD0-U+1CFF  Unicode Vedic Extensions block (41/48 assigned;
                   gaps are Unicode 12/13 additions or unassigned
                   codepoints that the donor does not have either)

Implementation
--------------
vedic-build/graft_vedic.py
  - Flattens donor composites via DecomposingRecordingPen.
  - Adapts geometry: above-marks have bbox-bottom aligned to Y=600
    (Baloos existing mark band); all marks centered at X=-300 so they
    land over a typical Telugu base under static positioning.
  - Sets zero advance width, GDEF class 3 (mark), and adds cmap
    entries on the Windows BMP subtable.

vedic-build/add_vedic_gpos.py
  - Adds a new GPOS lookup (type 4, MarkBasePos) with anchors on
    74 Telugu consonants (top-center at ymax + 220) and 27 Vedic
    above-marks (bottom-center at ymin).
  - Excludes above-base matras and halant from the base coverage so
    the mark attaches to the consonant directly rather than to a
    matras off-center bbox.
  - Registers a new abvm feature on the tel2 and telu scripts.

Build pipeline
--------------
  TTX -> intermediate TTF (via fontTools.ttx)
       -> patched TTF      (via graft_vedic.py)
       -> patched TTF      (via add_vedic_gpos.py adds GPOS)

The five patched TTFs land in BalooTammudu2-Telugu/vedic-build/ and
are gitignored (covered by repo-wide *.ttf rule); regenerate with
the pipeline documented in vedic-build/README.md.

Scope and caveats
-----------------
This is a non-authoritative prototype. The .vfb sources in
BalooTammudu2-Telugu/*/VFB/ are unchanged. A feature request tracking
the proper work has been filed at github.com/EkType/Baloo2/issues.

Limitations of the graft:
  - Style mismatch: Notos stroke contrast differs from Baloos.
  - Only above-marks get GPOS anchors; below-marks (U+0952 anudatta
    and a few in Vedic Extensions) rely on static positioning.
  - Tall above-base matras like matraIi come within ~80 units of the
    marks; tune BASE_ANCHOR_Y_GAP in add_vedic_gpos.py for more
    clearance.

TODO for the proper fix (full list in vedic-build/README.md):
  - Draw native Vedic glyphs in FontLab matched to Baloos display
    style, in all five weights. This is the blocker.
  - Add GlyphOrderAndAliasDB and GDEF entries for the new glyphs.
  - Design real GPOS anchors (above and below) in the .vfb sources
    rather than the heuristic this prototype uses.
  - Handle above-base matras via mkmk anchors or contextual GPOS
    instead of the current exclude-from-coverage workaround.
  - Register abvm/blwm features in the source feature tables so the
    fix survives the next VFB->TTF rebuild (this prototype patches
    GPOS at the TTF level only).
  - Cover the seven gaps the donor lacks (U+1CF7, U+1CFA).
  - Visual QA across a Vedic test corpus.
  - Remove vedic-build/ once proper sources ship.

Files changed
-------------
  OFL.txt                                       Noto attribution per OFL S4
  BalooTammudu2-Telugu/vedic-build/.gitignore   Skip donor tree, ephemera
  BalooTammudu2-Telugu/vedic-build/README.md    Pipeline, caveats, TODO
  BalooTammudu2-Telugu/vedic-build/graft_vedic.py
  BalooTammudu2-Telugu/vedic-build/add_vedic_gpos.py

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Second-round prototype work that (a) rounds out the OpenType layout side
that VOLT would otherwise be used for interactively, and (b) packages
the result as a web font in the shape a Google Fonts release would take.

Note on VOLT
------------
VOLT was considered per the TODO list, but it is a Windows GUI tool for
editing OT layout tables (GSUB/GPOS/GDEF) that must be driven by hand,
and it does not draw glyphs. The programmatic pipeline in this directory
produces the same tables VOLT would emit, without requiring interactive
GUI work. VOLT would not lift the real blocker (drawing native Vedic
outlines in FontLab).

Layout additions (add_vedic_gpos.py)
------------------------------------
- New blwm MarkBasePos lookup (type 4) with anchors on 17-18 below-marks
  (U+0952 anudatta plus the below-mark subset of Vedic Extensions),
  attaching them to Telugu consonants at (xmid, ymin - 150).
- New mkmk MarkMarkPos lookup (type 6) so a Vedic above-mark stacks on
  top of a preceding Vedic above-mark. Rare in practice but correct.
- The abvm lookup is unchanged (Telugu consonants at ymax + 220).
- All three new features are wired onto the tel2 and telu scripts.

Note: matras (matraOo, matraE, ...) are still excluded from base
coverage. mkmk on matras would require reclassifying them as GDEF
marks, which conflicts with USE Indic shaping and was not done. This
tradeoff is now documented in the README.

Web-font distribution (prepare_webfont.py + webfont/)
-----------------------------------------------------
- New prepare_webfont.py script renames each patched TTF to a derivative
  family named Baloo Tammudu 2 Vedic, updating name IDs 1/2/3/4/6/16/17,
  head.fontRevision, OS/2 achVendID (PRVR), and the version note. The
  name is deliberately distinct from the official Baloo Tammudu 2 to
  avoid identity collision with EkType/Google Fonts releases. OFL
  copyright/license records (IDs 0, 7, 13, 14) are preserved verbatim.
- Compresses each renamed TTF to WOFF2 using fontTools.woff2 (requires
  brotli). Output ~160KB per weight; Google-Fonts-scale sizes.
- webfont/styles.css: @font-face rules for all 5 weights with
  font-display: swap and unicode-range filtered to Latin + Telugu +
  Vedic (U+0951-0954, U+0C00-0C7F, U+1CD0-1CFF).
- webfont/demo.html: visual smoke test rendering across all weights,
  with Vedic sample strings including Rgveda 1.1.1 opening and the
  bhurbhuvah svah invocation.
- webfont/README.md: hosting instructions.

Build pipeline (now four stages)
--------------------------------
  TTX -> intermediate TTF (via fontTools.ttx)
      -> patched TTF        (via graft_vedic.py)
      -> patched TTF        (via add_vedic_gpos.py: abvm/blwm/mkmk)
      -> renamed TTF+WOFF2  (via prepare_webfont.py)

TODO progress
-------------
Ticking off items from the previous commit TODO list:
  [x] GDEF classification of Vedic marks (was already done at TTF level)
  [x] GPOS anchors for below-marks (new: blwm)
  [x] Register abvm/blwm/mkmk features on tel2/telu scripts (TTF level)

Still open (documented in vedic-build/README.md):
  [ ] Draw native Vedic glyphs in FontLab matched to Baloo style
  [ ] Cover the 7 codepoints the donor lacks
  [ ] Move GDEF/GPOS edits into .vfb sources (not TTF-level patches)
  [ ] Contextual GPOS for matra clusters
  [ ] Designer visual QA of the anchor gap values

Files changed
-------------
  BalooTammudu2-Telugu/vedic-build/.gitignore              +*.woff2
  BalooTammudu2-Telugu/vedic-build/README.md               pipeline+TODO update
  BalooTammudu2-Telugu/vedic-build/add_vedic_gpos.py       +blwm +mkmk
  BalooTammudu2-Telugu/vedic-build/prepare_webfont.py      new
  BalooTammudu2-Telugu/vedic-build/webfont/styles.css      new
  BalooTammudu2-Telugu/vedic-build/webfont/demo.html       new
  BalooTammudu2-Telugu/vedic-build/webfont/README.md       new

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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