Playground
Type or paste Tibetan text. Pick a font, apply an effect, select specific words for mixed styling — then copy the generated code straight into your project.
Step 1 Add termaUI to your project
No build tools, no configuration, no fonts to download — everything comes from the CDN.
tr- classes together with lang="bo".
It will never touch Bootstrap, Tailwind, or any other CSS you already have.
4 fonts are bundled with the npm package. For all 44 fonts, also load termaui-fonts from CDN — see the fonts library for details.
Press ⌨ phonetic to type Tibetan from your keyboard. Select — system — font for English text. Writing a mix of English and Tibetan? Press the mixed button so termaUI scales and aligns both scripts. Use stack-safe for mantras or dharanis with complex stacked consonants.
Paste this straight into your website. The code updates live as you type and style above.
ZWS after tsheg — enables line-breaking
Tsheg before shad → non-breaking (་། → ༌།)
Tsheg before nyis-shad → non-breaking (་༎ → ༌༎)
Tsheg before gter-ma → non-breaking (་༔ → ༌༔)
Double-shad protected (། །)
Editor content — terma.prepare() status
Ghost circles — combining marks auto-clustered
Layer 1 — CSS fallback (instant, ~95% accurate)
Layer 2 — JS pixel-perfect (Canvas TextMetrics, 0.04px accuracy)
vertical-align = parentRatio × parentSize − spanRatio × spanSizeEach span's head mark ends up at
parentBaseline + parentRatio × parentSize — constant
for all spans, regardless of their individual font-size.
Ratio is measured via Canvas TextMetrics.actualBoundingBoxAscent / fontSize.
Jomolhari ratio ≈ 0.740 (head mark sits 74% of font-size above the baseline).
- CSS:
[lang="bo"]now includes ligatures + padding-block by default —.tr-guardand.tr-ligaturesno longer required on every element - CSS:
size-adjustadded to all 44@font-facedeclarations — fonts now render at comparable visual sizes out of the box; no manual font-size fiddling needed - CSS:
.tr-mixed— inline Tibetan inside English text: scales up 1.15× and adjusts baseline alignment automatically - CSS:
[contenteditable][lang="bo"]getswhite-space: pre-wrapautomatically — prevents ZWS from collapsing as users type - JS:
terma.prepareEditable(el)/terma.prepareAllEditables()— live ZWS maintenance for contenteditable Tibetan inputs; re-applies on each keystroke (debounced 150 ms) - JS:
terma-clusters.jsmodule —isTibetanCombining(code)andtibetanClusters(str)grapheme clustering utilities - JS:
terma.prepare()auto-clusters combining marks into.tr-clusterspans whenterma-clusters.jsis loaded — prevents dotted-circle artifacts with no extra code - JS:
terma.cluster(el)/terma.clusterAll()— explicit clustering API - CSS:
.tr-cluster— inline-block cluster container;.tr-render-safe— full rendering checklist for JS-generated containers - CSS: Head-mark alignment (Layer 1) — sized spans inside
[lang="bo"]getvertical-align: text-topautomatically; Latin spans classified as.tt-latinrevert to baseline - JS: Head-mark alignment (Layer 2) —
terma.prepare()now auto-aligns head marks (མགོ་ཅན) across mixed font-sizes using CanvasTextMetrics; pixel-perfect to 0.04px - JS:
terma.alignHeadMarks(el)/terma.alignHeadMarksAll()— explicit alignment API for dynamic size changes afterprepare() - JS:
terma.measureAscentRatio(fontFamily)— exposed Canvas ascent measurement for advanced use; cached per font family - JS: Automatic re-alignment on
document.fonts.ready— ascent cache clears and all aligned containers re-measure after webfont swap
- Fix: corrected GitHub repository URL in package.json
- Initial release — CSS framework with 44 Tibetan fonts, utility classes (
.tr-guard,.tr-ligatures, size, effects), andterma.jsline-breaking utilities (prepare(),prepareAll(),normalize())
Font Gallery — 44 Fonts
.tr-jomolhari
.tr-noto
.tr-machine-uni
.tr-babelstone
.tr-babelstone-slim
.tr-ddc-uchen
.tr-ddc-rinzin
.tr-gangjie
.tr-jamyang
.tr-monlam
.tr-panchen
.tr-riwoche
.tr-sadri
.tr-monlam-ouchan1
.tr-monlam-ouchan2
.tr-monlam-ouchan3
.tr-monlam-ouchan4
.tr-monlam-ouchan5
.tr-monlam-paytsik
.tr-monlam-tikrang
.tr-monlam-tiktong
.tr-qomolangma-sarchen
.tr-qomolangma-betsu
.tr-qomolangma-tsutong
.tr-noto-sans
.tr-misans
.tr-monlam-sans
.tr-drutsa
.tr-gangjie-drutsa
.tr-khampa-drutsa
.tr-sadri-drutsa
.tr-monlam-dutsa1
.tr-monlam-dutsa2
.tr-joyig
.tr-chuyig
.tr-bechu
.tr-noto-thin
.tr-noto-extralight
.tr-noto-light
.tr-noto
.tr-noto-medium
.tr-noto-semibold
.tr-noto-bold
.tr-noto-extrabold
.tr-noto-black
Visual Effects Gallery
.tr-text-rainbow
.tr-text-saffron
.tr-text-fire
.tr-shimmer
.tr-glow-aurora
.tr-text-lapis
.tr-emboss
.tr-outline-gold
.tr-text-ink
DOM Utilities — Dynamic Content
Dynamic Content Container — .tr-render-safe
A single class that applies the complete Tibetan rendering checklist to any container
whose text is inserted via JavaScript. Consolidates
.tr-ligatures + .tr-guard + .tr-overflow-safe
+ font stack — no more missing one property and wondering why stacks are broken.
<!-- Any container with JS-generated Tibetan text -->
<div class="tr-render-safe" lang="bo" id="output"></div>
<script>
document.getElementById('output').textContent = myTibetanString;
</script> "blws" "abvs" consonant stacking ·
padding-block: 0.25em clipping guard ·
word-break: keep-all · overflow-wrap: anywhere ·
line-height: 1.8 · antialiased rendering
Live Editing — terma.prepareEditable(el)
Keeps ZWS (zero-width spaces) and non-breaking tshegs up to date as the user types.
Without it, ZWS inserted by prepare() can be overwritten and line-breaking reverts.
Pair with lang="bo" — termaUI automatically adds white-space: pre-wrap
so ZWS characters are never collapsed.
ZWS re-applied 150 ms after each keystroke. Line-breaking stays correct.
<div contenteditable="true" lang="bo" class="tr-jomolhari" id="myEditor"></div>
<script>
// One call handles everything — no input listener needed
terma.prepareEditable(document.getElementById('myEditor'));
</script> Mixed Content — .tr-mixed
Tibetan script is taller than Latin at the same font-size.
Wrapping inline Tibetan in .tr-mixed scales it to 1.15em
and shifts the baseline by -0.15em so both scripts sit on the same visual line
without extra line-height or manual adjustments.
The Tibetan word for enlightenment is བྱང་ཆུབ། which is profound.
The Tibetan word for enlightenment is བྱང་ཆུབ། which is profound.
<p>The Tibetan word for enlightenment is <span lang="bo" class="tr-jomolhari tr-mixed">བྱང་ཆུབ།</span> which is profound. </p>
font-size: 1.15em · vertical-align: -0.15em ·
line-height: 1 · padding-block: 0 (overrides the container guard)