Skip to content

Instantly share code, notes, and snippets.

@lancejpollard
Last active September 28, 2025 10:24
Show Gist options
  • Save lancejpollard/a8629c1f3cc2f2b8edf3b796c6c42f93 to your computer and use it in GitHub Desktop.
Save lancejpollard/a8629c1f3cc2f2b8edf3b796c6c42f93 to your computer and use it in GitHub Desktop.
Tibetan Monospace Design

Tibetan Monospace Design

  • Tibetan monospace font (modifying Noto Serif Tibetan)
  • Consonants are the foundation of each syllable in Tibetan
  • Consonants can form clusters/stacks vertically
  • We normalize the consonant slot width (that is the monospace unit)
  • Shad is simple, it takes up 1 slot, left aligned, and that's it
  • Tsheg is hard, it doesn't get a slot,
  • Tsheg becomes ligature/combining character essentially
  • Need to adjust each consonant glyph to accomodate tsheg as ligature
  • And that should be it!

Some other simple cases to handle, outlined next. But not too undoable of a problem for Tibetan script at least :).

Tibetan Base Consonants

Everything is based around the 29 Tibetan consonants that are normalized to the same width, 1 mono slot. Here the are listed each next to a tsheg .

ཀ་ཁ་ག་ང་ཅ་ཆ་ཇ་
ཉ་ཏ་ཐ་ད་ན་པ་ཕ་
བ་མ་ཙ་ཚ་ཛ་ཝ་ཞ་
ཟ་འ་ཡ་ར་ལ་ཤ་ས་ཧ་

And the final ཨ་ also needs to be modified to accommodate the tsheg too, that is the a vowel, the only vowel which gets a block symbol.

Tibetan Character Stacking

Can have simple consonants with no stacking, or complex stacking with multiple other consonants and/or vowels, here's a few examples:

བསྒྲུབས། བརྒྱ། དགྲ། བསྐུར། འབྲས། རྒྱ་མཚོ། འབྲེལ། གཟུགས། བསྡུས། བརྙན། སྤྲྱོད། བསྒྲུབས་པ། འབྲུགས། སྦྱོངས།

Can get pretty tall and complicated in some rare cases (or theoretically, if you are just messing around with stacks and/or testing the Tibetan typography rendering engine :p).

For reference, it's all just b/c combining characters:

Tibetan Syllable Structure

  • Built around central consonant
  • Can merge tsheg on right to consonant on left

Tibetan Glyph Modification to Accomodate Tsheg as Ligature Instead

Basically just adjust each consonant glyph to accomodate the tsheg (and can make the tsheg even narrower too if necessary), so the tsheg no longer takes up a monospace slot. The tsheg could be treated as a combining character or ligature. Either (simple case), shrink the preceding character always (just the top portion ideally, but that would be more work, for now could just squeeze the width), and place an even thinner tsheg there (shrink the tsheg too, almost half width even, barely noticeable. Or (complex case), move the strokes of the consonant slightly to fit the thin tsheg!

So basically, ideal solution. Since tsheg ALWAYS appears on right of the syllable (line-break rules prevent tsheg starting a sentence from w3c), can just merge tsheg with left glyph stack basically. Basically just modifying the consonant glyphs a tiny bit, along with making the tsheg slightly thinner, even more tiny haha.

  • Some consonants have a horizontal line on top, just make that shorter on right
  • Some have vertical line on right, for these can just make the whole glyph thinner and/or sort of bend the top corner (in a beautiful way if possible, otherwise just thinner glyph is fine, it kind of matches real hand-writing where each glyph isn't exactly same width anyways!).
  • Some have a loop sort of thing (like o kind of), that can be bent a little, and also character thinner a little.

Basically slightly adjusting the consonants, the base of the ligature stack, so the tsheg becomes a ligature to the right on the stack too.

Real Manuscripts Have Embedded Tsheg Often Too

You can see in manuscripts, the tsheg sometimes overlaps other parts of the consonant stack vertically underneath.

(copied these zoomed in random manuscript snapshots from various places on the web, can lookup later again if necessary for more detail).

Tibetan Numbers

༠	༡	༢	༣	༤	༥	༦	༧	༨	༩ (0-9)
༪	༫	༬	༭	༮	༯ ༰	༱	༲	༳	(numerical fractions)
  • 1 mono slot each

Shad །

  • Shad ། takes up 1 monospace slot
  • Shad is left aligned (tight left)
  • So shad leaves some whitespace to the right

If there is a literal whitespace character after the shad, then ideally it would merge (be hidden, a "ligature with space"?).

  • If next character following shad is space character, merge as ligature

Also, if the shad is preceded by a space character, then that should be another ligature:

  • Right align shad in 1 monospace slot
  • Merge shad with previous space character as ligature (essentially getting rid of the previous space character)

Example of that here in the middle:

དུང་དང་འོ་མར་འགྲན་པའི་ལྷག་བསམ་མཐུ། །དམན་ཡང་དཀར་པོའི་བྱས་འབྲས་ཅུང་ཟད་ཅིག

Double Shad ༎

  • Can be used by writer instead of two single shads །།
  • Takes up 1 mono slot
  • Can make 2 single shads །། a ligature, taking up 1 mono slot too!

Parentheses

༼ (left)
༽ (right)
  • Each bracket takes up 1 mono slot
  • Potentially be rotated a tiny bit to fit the mono slot

Other Tibetan Punctuation Marks and Other Symbols

༏: tsheg + shad (ligature)
༐: tsheg + shad with tiny space (also ligature)
༑: like shad, but for end of story section
༒: ornamental, symbolizing closure
༓: like shad, but for end of entire book
༔: similar to comma (sometimes used)
༕: beginning-of-text flourish
༖: end-of-text flourish
༗  ༘  ༙: astrological symbols
༚	༛	༜	༝	༞	༟: shad ornamental flourishes
༴ (syntactic/abbreviation mark meaning "etc.")
༶ (caret-like sign, used as an editorial or insertion mark)
༸ (emphasis mark)
༺ ༻ (opening closing ornamentals)
ཿ (used in closing sacred syllables?)

So with those above:

  • ༏ ༐ ༑ these work just like shad
  • ༒ takes up 1 mono slot
  • ༓ takes up 1 mono slot
  • ༔ takes up 1 mono slot (perhaps middle line is elongated or whole thing is widened a little, and also center-aligned in mono slot)
  • ༕ ༖ ornaments just 1 mono slot too
  • ༗ ༘ ༙ just 1 mono slot, random signs
  • ༚ ༛ ༜ ༝ ༞ ༟ just make 1 mono slot, can refine later to ligatures perhaps to condense
  • ༴ 1 mono slot
  • ༶ 1 mono slot
  • ༸ 1 mono slot
  • ༺ ༻ 1 mono slot
  • ཿ 1 mono slot
  • U+0FC0 to U+0FDF are all ornamentals, 1 mono slot

Other Edges Cases to Consider

  • Writing 2+ tsheg in sequence.
    • Ideally to make it look nice, I'd put 2 or 3 within a single mono slot as complex ligatures.
    • Can discuss what's technically possible with fonts there
  • Writing 3+ shad , they should double or triple up too, to fill single mono slots in a packed sort of way if possible (long run, we can come back to).
  • If someone happens to type randomly ་།་་་་།།།།།་།།་།།་་་།།་་, whatever, it should optimally pack them into mono slots (probably 2 or 3, per slot, whatever looks good)
    • the last 2 should spread/widen slightly to fill 1 mono slot
    • up to 3 per mono slot

So thinking more, the ideal ideal would be (probably too complicated for a font file, but let me know!):

  1. 1 tsheg or 1 shad or 1 tsheg + 1 shad (desired/common/grammatically correct case)
  2. 2 tsheg (in this case don't create the ligature, leave alone, just put both tsheg in the next 1 mono slot together, and spread out / widen a tiny bit to fill space-between basically).
  3. 3 tsheg (1 becomes ligature, 2 become fill-space-between in next 1 mono slot).
  4. 4 tsheg (1 becomes ligature, 3 become fill-space-between in next 1 mono slot).
  5. 5 tsheg (1 becomes ligature, 3 become fill-space-between in next 1 mono slot, 2 in slot after that, etc..).

So you see the pattern, 1 is ligature, 2 is not ligature, 3+ is ligature plus right space filling, with min 2 and max 3 tsheg per mono slot. Unless 3 looks back, then it's simpler, just 2 tsheg max per slot 🤷.

Example Text Snippets

དུང་དང་འོ་མར་འགྲན་པའི་ལྷག་བསམ་མཐུ། །དམན་ཡང་དཀར་པོའི་བྱས་འབྲས་ཅུང་ཟད་ཅིག །བློ་དང་འདུན་པ་བཟང་བའི་རང་རིགས་ཀུན། །རྒྱལ་ཁའི་འཕྲིན་བཟང་ལས་དོན་འགྲུབ་ཕྱིར་འབད།།

Some Snippets of Tibetan Script Edge-Cases

# Heavy Consonant Stacks
བརྙན། སྒྲུབས། རྨྱུགས། སྤྲྱོད། གྲྭས། བསྒྲུབས། སྤྱིར། བརྩམས།

# Diacritic Pile-ups
ཀིཾཿ  གོོཿ  ཤེཿཾཿ  ཨོཾཿ དེོཿཾ

# Rare Punctuation and Head Marks
༄༅། ༑ ༔ ༕ ༖ ༗ ༘༔། ༼ཨོཾ༽ ༿ ༻ཧཱུྃ༼ ༽

# Old-style Numerals
༠༡༢༣༤༥༦༧༨༩  ༪༫༬༭༮༯༰༱༲༳

# Embedded Sanskrit Mantric Forms
ༀ་ཨོཾ་མ་ཎི་པདྨེ་ཧཱུྃ༔  
ཧཱུཿ ཨཿ ཧཱུྃ༔ ཧྲཱིཿ ཧཱུཿ

# Parentheses & Mixed Marks
༼རྒྱུད༽ ༽བསྒྲུབས༼ ༼གིས༽༼དགེ༽

# Extra-Obscure Signs (U+0F70+)
ཨཱྀཿ ཨཱིྃ ཨཱུྂ ཨིྃ ཨོྂ ཨུྂ ༔  
ཧྲཱིཿ ཨཱྀཿ ཨོྂ དང་པོ་སྐུའི་འོད།  
གཞན་ཡང་། ཨཱིྃ་སྨིན་པའི་མདོར་བསྡུས༔  
ཨུྂ་དང་མཉམ་པར་བསྒྲུབས་པའི་སྔོན་འགྲོ།

# Decorative/Religious Marks
ༀ ༁ ༂ ༃ ༄ ༅ ༆ ༇ ༈ ༉ ༊  
ༀ་ཨོཾ་མ་ཎི་པདྨེ་ཧཱུྃ༔ ༄༅། ༻ཧཱུྃ༼ ༽  
࿄ ࿅ ࿆ ࿇ ࿈ ࿉ ࿊ ࿋ ࿌ ࿍ ࿎ ࿏ ࿐ ࿑ ࿒  
࿄བསྒྲུབས་དུས་སུ༔ ༔ ༀ་བདེ་སྐྱིད་དུ། ࿇ ࿉ ࿊

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment