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
CommonZyyy
InheritedZinh
UnknownZzzz
ArabicArab
ArmenianArmn
BengaliBeng
CyrillicCyrl
DevanagariDeva
GeorgianGeor
GreekGrek
GujaratiGujr
GurmukhiGuru
HangulHang
HanHani
HebrewHebr
HiraganaHira
KannadaKnda
KatakanaKana
LaoLaoo
LatinLatn
MalayalamMlym
OriyaOrya
TamilTaml
TeluguTelu
ThaiThai
TibetanTibt
BopomofoBopo
BrailleBrai
Canadian SyllabicsCans
CherokeeCher
EthiopicEthi
KhmerKhmr
MongolianMong
MyanmarMymr
OghamOgam
RunicRunr
SinhalaSinh
SyriacSyrc
ThaanaThaa
YiYiii
DeseretDsrt
GothicGoth
Old ItalicItal
BuhidBuhd
HanunooHano
TagalogTglg
TagbanwaTagb
CypriotCprt
LimbuLimb
Linear BLinb
OsmanyaOsma
ShavianShaw
Tai LeTale
UgariticUgar
BugineseBugi
CopticCopt
GlagoliticGlag
KharoshthiKhar
New Tai LueTalu
Old PersianXpeo
Syloti NagriSylo
TifinaghTfng
BalineseBali
CuneiformXsux
NkoNkoo
Phags-paPhag
PhoenicianPhnx
CarianCari
ChamCham
Kayah LiKali
LepchaLepc
LycianLyci
LydianLydi
Ol ChikiOlck
RejangRjng
SaurashtraSaur
SundaneseSund
VaiVaii
AvestanAvst
BamumBamu
Egyptian HieroglyphsEgyp
Imperial AramaicArmi
Inscriptional PahlaviPhli
Inscriptional ParthianPrti
JavaneseJava
KaithiKthi
LisuLisu
Meetei MayekMtei
Old South ArabianSarb
Old TurkicOrkh
SamaritanSamr
Tai ThamLana
Tai VietTavt
BatakBatk
BrahmiBrah
MandaicMand
ChakmaCakm
Meroitic CursiveMerc
Meroitic HieroglyphsMero
MiaoPlrd
Sora SompengSora
TakriTakr

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.