Harfbuzz codes
The Citrine Media Plugin enables text shaping for various languages and scripts using the powerful Harfbuzz library in combination with SDL. By utilizing the style:direction: message, you can specify a Harfbuzz shaping script to properly render text according to the writing system of the language. For example:
font style: ['Arab'] direction: 1.
In the example above, the font style is set to Arabic ('Arab'), and the writing direction is set to right-to-left (1). The available writing directions are:
- 0 = left-to-right
- 1 = right-to-left
- 2 = top-to-bottom
- 3 = bottom-to-top
For more details, refer to TTF_SetFontDirection. Below is a list of Harfbuzz script codes for various shaping systems:
Script/Language | Code |
---|---|
Common | Zyyy |
Inherited | Zinh |
Unknown | Zzzz |
Arabic | Arab |
Armenian | Armn |
Bengali | Beng |
Cyrillic | Cyrl |
Devanagari | Deva |
Georgian | Geor |
Greek | Grek |
Gujarati | Gujr |
Gurmukhi | Guru |
Hangul | Hang |
Han | Hani |
Hebrew | Hebr |
Hiragana | Hira |
Kannada | Knda |
Katakana | Kana |
Lao | Laoo |
Latin | Latn |
Malayalam | Mlym |
Oriya | Orya |
Tamil | Taml |
Telugu | Telu |
Thai | Thai |
Tibetan | Tibt |
Bopomofo | Bopo |
Braille | Brai |
Canadian Syllabics | Cans |
Cherokee | Cher |
Ethiopic | Ethi |
Khmer | Khmr |
Mongolian | Mong |
Myanmar | Mymr |
Ogham | Ogam |
Runic | Runr |
Sinhala | Sinh |
Syriac | Syrc |
Thaana | Thaa |
Yi | Yiii |
Deseret | Dsrt |
Gothic | Goth |
Old Italic | Ital |
Buhid | Buhd |
Hanunoo | Hano |
Tagalog | Tglg |
Tagbanwa | Tagb |
Cypriot | Cprt |
Limbu | Limb |
Linear B | Linb |
Osmanya | Osma |
Shavian | Shaw |
Tai Le | Tale |
Ugaritic | Ugar |
Buginese | Bugi |
Coptic | Copt |
Glagolitic | Glag |
Kharoshthi | Khar |
New Tai Lue | Talu |
Old Persian | Xpeo |
Syloti Nagri | Sylo |
Tifinagh | Tfng |
Balinese | Bali |
Cuneiform | Xsux |
Nko | Nkoo |
Phags-pa | Phag |
Phoenician | Phnx |
Carian | Cari |
Cham | Cham |
Kayah Li | Kali |
Lepcha | Lepc |
Lycian | Lyci |
Lydian | Lydi |
Ol Chiki | Olck |
Rejang | Rjng |
Saurashtra | Saur |
Sundanese | Sund |
Vai | Vaii |
Avestan | Avst |
Bamum | Bamu |
Egyptian Hieroglyphs | Egyp |
Imperial Aramaic | Armi |
Inscriptional Pahlavi | Phli |
Inscriptional Parthian | Prti |
Javanese | Java |
Kaithi | Kthi |
Lisu | Lisu |
Meetei Mayek | Mtei |
Old South Arabian | Sarb |
Old Turkic | Orkh |
Samaritan | Samr |
Tai Tham | Lana |
Tai Viet | Tavt |
Batak | Batk |
Brahmi | Brah |
Mandaic | Mand |
Chakma | Cakm |
Meroitic Cursive | Merc |
Meroitic Hieroglyphs | Mero |
Miao | Plrd |
Sora Sompeng | Sora |
Takri | Takr |
HarfBuzz is an open-source text shaping engine used for complex text layout. It plays a critical role in rendering text by transforming strings of Unicode text into positioned glyphs making it a vital component in the display of text in modern applications. HarfBuzz is widely used in various software applications, including browsers, word processors, and operating systems, to ensure that text is displayed correctly and beautifully, especially for languages with complex scripts.
Why do you need text shaping?
Text isn’t the same in every language. Some languages, like Arabic, need characters to change shape depending on where they are in a word, while others, like Thai, stack characters. Harfbuzz understands the rules for these languages and makes sure the text looks correct.