Pango
- 2 min read
- 3 chapters
Related on Lably
Through Library (computing)
Full-function rendering of text and cross-platform support is achieved when Pango is used with platform APIs or third-party libraries, such as Uniscribe and FreeType, as text rendering backends. Pango-processed text will appear similar under different operating systems.
Pango is a special-purpose library for text and not a general-purpose graphics rendering library such as Cairo, with which Pango can be used. The Cairo documentation recommends Pango be used to "render" text rather than Cairo for all but the simplest text "rendering".
History and naming
The name pango comes from Greek pan (παν, 'all') and Japanese go (語, 'language').
In January 2000, the merger of the GScript and GnomeText projects was named Pango.
Pango version 1.0.0 was released 11 March 2002.
Sign in to keep reading
2 more chapters are free with a Lably account.
Support for OpenType features
Pango 1.17 and newer support the 'locl' feature tag that allows localized glyphs to be used for the same Unicode code point. Assuming you have Verdana version 5.01 installed, which supports the 'locl' feature for the latn/ROM (Romanian) script, a quick demonstration (on Linux) is:
<span id="mwSA"></span><span class="k" id="mwSQ">for</span><span class="w" id="mwSg"> </span>lang<span class="w" id="mwSw"> </span><span class="k" id="mwTA">in</span><span class="w" id="mwTQ"> </span>en<span class="w" id="mwTg"> </span>ro <span class="k" id="mwTw">do</span> <span class="w" id="mwUA"> </span>pango-view<span class="w" id="mwUQ"> </span><span class="se" id="mwUg">\</span> <span class="w" id="mwUw"> </span>--font<span class="o" id="mwVA">=</span><span class="s2" id="mwVQ">"Verdana 64"</span><span class="w" id="mwVg"> </span><span class="se" id="mwVw">\</span> <span class="w" id="mwWA"> </span>--text<span class="w" id="mwWQ"> </span><span class="s2" id="mwWg">"şţ vs. șț in </span><span class="nv" id="mwWw">$lang</span><span class="s2" id="mwXA">"</span><span class="w" id="mwXQ"> </span><span class="se" id="mwXg">\</span> <span class="w" id="mwXw"> </span>--language<span class="o" id="mwYA">=</span><span class="nv" id="mwYQ">$lang</span> <span class="k" id="mwYg">done</span>
For an explanation of the substitutions rules for Romanian, see this discussion.
Setting the locale via the POSIX environment variable, e.g. LANG=ro_RO.UTF-8 will also cause Pango to use 'locl' font feature. Finally, you can change the language on the fly in the same text using Pango markup, e.g.:
<span id="mwaQ"></span>pango-view<span class="w" id="mwag"> </span><span class="se" id="mwaw">\</span> <span class="w" id="mwbA"> </span>--font<span class="o" id="mwbQ">=</span><span class="s2" id="mwbg">"Verdana 24"</span><span class="w" id="mwbw"> </span><span class="se" id="mwcA">\</span> <span class="w" id="mwcQ"> </span>--markup<span class="w" id="mwcg"> </span><span class="se" id="mwcw">\</span> <span class="w" id="mwdA"> </span>--text<span class="w" id="mwdQ"> </span><span class="s1" id="mwdg">'In the same text: şţ(en) and <span lang="ro">şţ(ro).</span>'</span>
Since 1.37.1, Pango added more attributes to provide complete support for processing OpenType feature.
The official showcase of Pango's script-aware features is here.
Major users
Pango has been integrated into most Linux distributions. The GTK UI toolkit uses Pango for all of its text rendering. The Linux versions of the Mozilla Firefox web browser and Mozilla Thunderbird mail client use Pango for text rendering.

