Hubbry Logo
PangoPangoMain
Open search
Pango
Community hub
Pango
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Pango
Pango
from Wikipedia

Original authorsOwen Taylor[1]
Raph Levien
DeveloperBehdad Esfahbod
Initial release11 July 1999; 26 years ago (1999-07-11)[2]
Stable release
1.57.0[3] Edit this on Wikidata / 25 August 2025; 2 months ago (25 August 2025)
Repository
Written inC
Operating systemUnix-like, Microsoft Windows, Other
TypeSoftware development library
LicenseLGPL
Websitewww.gtk.org/docs/architecture/pango

Pango (stylized as Παν語) is a text (i.e. glyph) layout engine library which works with the HarfBuzz shaping engine for displaying multi-language text.[4]

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.[clarification needed]

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".[5]

History and naming

[edit]

The name pango comes from Greek pan (παν, 'all') and Japanese go (, 'language').[6]

In January 2000, the merger of the GScript and GnomeText projects was named Pango.[7][8][9][10][11][12]

Pango version 1.0.0 was released 11 March 2002.[13][14]

Support for OpenType features

[edit]
Default rendering above, localized Romanian rendering below.

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:

for lang in en ro
do
    pango-view \
        --font="Verdana 64" \
        --text "şţ vs. șț in $lang" \
        --language=$lang
done

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.:

pango-view \
    --font="Verdana 24" \
    --markup \
    --text 'In the same text: şţ(en) and <span lang="ro">şţ(ro).</span>'

Since 1.37.1, Pango added more attributes to provide complete support for processing OpenType feature.[15][16][17]

The official showcase of Pango's script-aware features is here.

Major users

[edit]
Simplified software architecture of GTK. Pango, GDK, ATK, GIO, Cairo and GLib.

Pango has been integrated into most Linux distributions. The GTK UI toolkit uses Pango for all of its text rendering.[18] The Linux versions of the Mozilla Firefox web browser and Mozilla Thunderbird mail client use Pango for text rendering.[19]

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Pango is a free and open-source for the layout and rendering of text, with a particular emphasis on to support complex scripts and multiple languages. Developed initially as a test platform for the , it provides high-level APIs for formatting paragraphs, handling , and integrating with graphics backends like . The library's name derives from the Greek word πᾶν (pān), meaning "all," and the Japanese character 語 (go), meaning "language," stylized as Παν語 to reflect its multilingual focus. Originating in 1999 under the lead development of Owen Taylor at Red Hat, Inc., Pango was designed to create a modular framework for Unicode text processing, enabling easy extension for new scripts and rendering technologies. Its first stable release, version 1.0, arrived in 2002 and was integrated into GTK+ 2.0, marking a significant advancement in open-source text handling for GNOME applications. Key features include support for OpenType fonts, line breaking, shaping via the HarfBuzz engine, and backends for platforms such as FreeType, Xft, Win32, and macOS Core Text, ensuring portability across Linux, Unix-like systems, Windows, and other environments. Pango has evolved through ongoing contributions from community, with milestones like version 1.2 in 2003 adding Indic script support and version 1.4 in 2004 incorporating 4.0 and enhanced handling. As of 2025, the latest stable release is version 1.57.0 (25 August 2025), maintaining its role as a foundational component in GTK-based software, including desktop environments, web browsers like , and text editors, while prioritizing high-quality rendering and script extensibility. Its design promotes collaboration, allowing developers worldwide to contribute modules for specific languages, such as those for Thai or right-to-left scripts, without altering the core engine.

History

Origins and Early Development

The unification of the GScript project, which focused on script-specific text shaping for complex scripts, and the GnomeText project, which handled basic text rendering, was proposed in 1999, with the merger occurring in January 2000. This unification was proposed to meet the growing requirements of desktop environment, enabling better support for multilingual text handling in open-source applications. The original authors of Pango were Owen Taylor, a developer at , and Raph Levien, who drafted the initial unification proposal. Ongoing development and maintenance have been led by Behdad Esfahbod, who has contributed significantly to its evolution as a core component of GNOME's text rendering infrastructure. Pango was first released in 1999 as an open-source C library licensed under the LGPL, targeted primarily at systems. Its early goals centered on providing a modular framework for the layout and rendering of internationalized text, with robust support for encoding and complex writing systems such as those involving right-to-left directionality or contextual shaping.

Key Milestones and Releases

The name Pango originated in January 2000 from the merger of the GScript and GnomeText projects, derived from "pan" (παν, meaning "all") and Japanese "go" (語, meaning "language"), stylized as Παν語 to emphasize its support for multilingual text rendering. Pango achieved its first stable release with version 1.0.0 on March 8, 2002, establishing a reliable for internationalized text layout and rendering that became foundational for GTK+ applications. In the early 2000s, Pango integrated deeply into the desktop environment, enhancing and text handling across +-based software as part of GNOME's push for robust support. A significant evolution occurred with the adoption of as the default text shaper; initial integration began in version 1.13.0 released on April 23, 2006, by moving Layout code to HarfBuzz, with full platform-wide adoption in version 1.44.0 on July 27, 2019, replacing dependencies for font loading and metrics. Ongoing maintenance is led by the community through its repository, with substantial contributions from engineers focusing on stability, security, and cross-platform compatibility. The latest stable release, version 1.57.0 on August 25, 2025, includes bug fixes for Core Text rendering, Windows performance optimizations, and added macOS Cocoa windowing support in the pango-view tool, alongside cleanup of legacy code for improved cross-platform portability.

Architecture

Core Components

Pango's core engine serves as the foundational layer of the library, providing a public for text processing and rendering while maintaining a backend-agnostic design. This engine orchestrates the transformation of input text into rendered output through stages such as itemization, shaping, and positioning, utilizing structures like PangoGlyphInfo to store glyph-level details including and visual attributes. The driver logic within the core facilitates modular pipelines, allowing integration with various shaping and font systems without tying to specific rendering implementations. At the heart of Pango's high-level functionality is the PangoLayout object, which handles the layout and analysis of entire text blocks, such as paragraphs. Initialized with a PangoContext, encoded text, and optional attributes, PangoLayout performs tasks like line breaking, alignment, justification, and ellipsization, enabling applications to query metrics such as ink extents and positions for interactive use cases. This object abstracts complex text processing, converting logical character positions to visual arrangements while supporting and varying script requirements. The attribute system in Pango enables fine-grained control over text appearance and behavior through structures like PangoAttrList, which manages lists of attributes applicable to specific text ranges. These attributes encompass font variations (such as family, style, and size), colors, underlines, and language tags, allowing overlapping specifications for rich text formatting. PangoAttrList integrates seamlessly with PangoLayout, where attributes influence itemization and shaping processes to ensure contextually appropriate rendering. Pango's modular design emphasizes Unicode conformance and robust handling of diverse writing systems, decoupling layout logic from rendering details to support global internationalization. By processing text in and leveraging properties for script detection and bidirectional resolution, the core components facilitate support for scripts ranging from Latin to complex Indic and right-to-left systems like . This architecture promotes extensibility, with the core engine providing hooks for language-specific modules while prioritizing universal text analysis.

Rendering Backends and Modules

Pango utilizes platform-specific rendering backends to interface with native systems, enabling efficient text rasterization and display across diverse operating environments. These backends abstract low-level font handling and output, allowing the core layout engine to remain platform-agnostic while leveraging system optimizations for performance and quality. The PangoFT2 backend targets and systems, integrating for font rasterization and for system-wide font discovery and selection. This combination supports high-fidelity rendering of complex scripts and variable fonts, making it the default choice for open-source desktop environments like . For Windows platforms, the PangoWin32 backend accesses native fonts through the GDI API for traditional rendering, while supporting DirectWrite in modern implementations to provide subpixel antialiasing, layout features, and improved handling of international text. This dual approach ensures compatibility with legacy and contemporary Windows versions. On macOS, the PangoCoreText backend relies on Apple's Core Text framework for font management and rendering, utilizing system-native APIs to achieve precise glyph positioning, color font support, and integration with AppKit or . This backend optimizes text output for and Intel architectures alike. Pango's integration with the graphics library enables versatile output beyond direct display, such as generating PDF documents, vectors, or in-memory image buffers via PangoCairo functions that draw layouts onto Cairo surfaces. This abstraction layer supports cross-platform consistency in non-interactive rendering scenarios. Font map and engine modules form the backbone of Pango's rendering , with font maps aggregating available fonts for selection based on and style requirements, and modules overseeing rasterization and script-specific processing. These components ensure scalable font handling without tight coupling to specific backends. Pango facilitates client-side rendering on X11 via the PangoXft backend, which uses Xft for antialiased fonts and direct Xlib integration, and on Wayland, where applications render text off-screen using Cairo-backed buffers before submitting them to the compositor for composition. This approach aligns with Wayland's client-driven model, avoiding server-side drawing.

Features

Text Shaping and Layout

Pango's text layout process begins with itemization, where input text is divided into segments based on script, , and direction, followed by shaping and positioning to arrange s appropriately for display. This includes handling using the Bidirectional Algorithm to support left-to-right (LTR) and right-to-left (RTL) scripts such as English and , respectively, with automatic direction detection and explicit overrides via settings. Line breaking is performed according to script-specific rules, considering hyphenation and wrap modes to fit text within specified widths, while justification stretches spaces or adjusts spacing to align lines evenly, including options for the last line in paragraphs. For complex scripts requiring advanced glyph arrangement, Pango integrates with the shaping engine, which has served as the default shaper since version 1.44 in 2019, processing layout tables like GSUB for glyph substitutions and GPOS for positioning adjustments. This enables accurate rendering of scripts such as , where cursive connections and contextual forms are essential, and , involving consonant clusters and vowel matras. The integration ensures consistent handling across platforms, replacing earlier engine-specific implementations for improved reliability in internationalized environments. Recent versions, such as 1.57.0 (August 2025), have further enhanced this with full 16 compatibility. Pango emphasizes internationalization by supporting vertical writing systems common in , such as Japanese and Chinese, through gravity settings that rotate glyphs 90 degrees counterclockwise and manage mixed horizontal-vertical layouts without disrupting bidirectional flow. This capability, introduced in version 1.16, allows for proper orientation of punctuation and symbols in vertical contexts. Overall, Pango accommodates virtually all major world scripts via its modular design and backend, facilitating layout for diverse linguistic requirements from Latin to Indic and Southeast Asian systems. In glyph clustering and positioning, Pango groups multiple characters into logical clusters to preserve editing boundaries, particularly in scripts where intra-cluster reordering is prohibited, such as Thai. Positioning accounts for ligatures by substituting multiple glyphs with a single composite form where supported by the font, applies to fine-tune inter-glyph spacing based on pairwise adjustments, and ensures mark attachment by aligning diacritics and combining characters precisely over base glyphs using attachment points defined in tables. These operations occur during the shaping phase without dependency on specific rendering backends, yielding a PangoGlyphString that represents the final arranged output.

Font and OpenType Support

Pango integrates font technology to enable advanced typographic features, starting with support for the 'locl' feature tag for localized forms introduced in version 1.17 in 2007. This allows for language-specific substitutions, such as variant forms of characters tailored to regional orthographies, enhancing the accuracy of international text rendering. Support for was significantly expanded in version 1.37.1, released in 2015, which added attributes enabling broader scripting of font features for more precise control over typographic variations across scripts. Developers can now apply these enhancements to handle complex positioning and substitutions dynamically during layout. Recent releases like 1.57.0 (August 2025) have added support for additional features such as petite caps. The PangoAttrFontFeatures , available since version 1.38, provides a mechanism to selectively enable specific tables, such as 'kern' for pairwise adjustments, 'liga' for standard ligature formation, and 'ssXX' (where XX denotes a number) for stylistic sets that offer alternative designs. This attribute accepts a string in CSS font-feature-settings syntax, allowing fine-grained customization without relying solely on default font behaviors. For instance, enabling 'liga=1' promotes the use of connected letter forms in scripts like Latin or where appropriate. Pango maintains compatibility with for discovering and matching system fonts based on criteria like family, style, and language, ensuring seamless access to installed font libraries. For rasterization, it leverages to generate bitmaps and outlines, supporting high-quality rendering across various font formats including and . This integration facilitates efficient font handling in diverse environments, from desktop applications to embedded systems. Pango's multi-script rendering capabilities apply OpenType features across writing systems, enabling accurate layout for languages ranging from Latin and Cyrillic to Devanagari and Han.

API and Usage

Programming Interfaces

Pango provides a structured set of programming interfaces that enable developers to handle text layout and rendering, ranging from low-level routines for granular control to high-level abstractions for streamlined application integration. The primary interface is implemented in C, accessible through the header file pango/pango.h, which includes functions for core operations like text itemization and glyph shaping. This C API serves as the foundation, with higher-level functions building upon it to abstract complex processes into more manageable workflows. At the high level, the API offers objects and functions such as PangoLayout, which developers can instantiate using pango_layout_new() to create a new layout context associated with a specific PangoContext. Once created, text can be set via pango_layout_set_text(), allowing the specification of the string to render along with attributes like font and language. Metrics and positioning are then retrieved through pango_layout_get_extents(), which returns ink and logical extents in Pango units (1/1024th of a point) for precise bounding box calculations. These functions facilitate rapid prototyping and integration in graphical applications by encapsulating the full layout pipeline. For lower-level customization, Pango exposes routines like pango_itemize(), which processes input text to break it into language-specific segments called PangoItems, each containing properties such as script, , and font metrics for subsequent processing. Following itemization, pango_shape() applies shaping algorithms—often in conjunction with —to convert character clusters into positioned glyphs, enabling developers to build custom text pipelines or extend Pango's behavior for specialized rendering needs. This modular approach allows fine-grained control over features without relying on the full high-level layout system. Pango's interfaces extend beyond C through GObject introspection, which generates dynamic bindings for various languages. In Python, bindings are provided via PyGObject, allowing seamless use of Pango functions within GTK-based applications. For JavaScript environments, GJS offers native support, integrating Pango into web and desktop extensions. Other languages, such as or Vala, can leverage these bindings through introspection tools, promoting cross-language portability while maintaining compatibility with the core C . Runtime version validation is supported by pango_version_check(), a function that takes the required major, minor, and micro version numbers as integers, returning NULL if compatible or a string describing the mismatch otherwise. This ensures applications can detect mismatches and adapt accordingly, enhancing reliability in diverse deployment environments.

Integration in Applications

Pango serves as the default text rendering engine for widgets, such as GtkLabel and GtkTextView, enabling high-quality layout and display of complex scripts within graphical user interfaces. This integration allows developers to leverage Pango's capabilities directly through GTK's widget system, where text properties like font family, size, and style are managed via the toolkit's theming mechanism. In particular, font settings for these widgets can be customized and themed using CSS, permitting applications to define stylesheets that influence Pango's rendering behavior, such as specifying font features compatible with syntax. For applications outside the ecosystem, Pango can be integrated via the PangoCairo library, which facilitates custom text rendering on surfaces for tasks like PDF generation or output. This approach is particularly useful in non- environments, including game engines built with SDL, where libraries like SDL2_Pango bridge Pango's layout engine to SDL's rendering pipeline, supporting dynamic text display in 2D games and simulations. Configuration of Pango in applications often involves environment variables to select rendering backends, such as setting PANGOCAIRO_BACKEND to "fc", "win32", or "coretext" to override the default backend for specific platforms or performance needs. Additionally, Pango handles fallback fonts automatically for missing glyphs by consulting system font configurations, ensuring complete coverage without application-level intervention in most cases; this can be fine-tuned using attributes like pango_attr_fallback_new to disable or control fallback behavior. In text editing applications, Pango supports bidirectional input and precise positioning, essential for (i18n)-aware editors handling languages like or Hebrew. Functions such as pango_layout_move_cursor_visually compute logical cursor movements across bidirectional boundaries, while Pango's layout engine resolves text directionality to maintain accurate visual editing flows. This enables seamless integration, allowing users to compose and edit mixed-direction text in widgets or custom editors.

Adoption

Major Users

Pango serves as a foundational text rendering library within , powering key applications such as for document editing and for file management interfaces. These tools leverage Pango through the framework to handle and requirements essential to the GNOME ecosystem. On , Mozilla's web browser and Thunderbird email client use Pango via the framework for rendering their user interfaces, while utilizing for text shaping in web content and emails to ensure proper display across diverse languages and scripts. Beyond and Mozilla, Pango supports specialized creative software, including , where it facilitates internationalized text layout in editing. Similarly, utilizes Pango for accurate text layer rendering in image manipulation tasks. incorporates Pango partially, particularly for UI elements on via integration, complementing its internal document rendering systems. Additionally, WebKitGTK, the web rendering engine for GNOME applications like Epiphany, uses Pango for text layout and rendering. Pango's development is driven by the project, with substantial maintenance and enhancements from engineers, alongside contributions from a worldwide community of open-source developers. This collaborative effort underscores Pango's role as a robust, widely adopted component in cross-platform text handling.

Platform and Distribution Support

Pango supports a range of operating systems, including systems such as and BSD variants, where it leverages for font rendering and for font management, often integrated with Xft for X11-based environments. On Microsoft Windows, Pango utilizes native fonts through the Win32 API or falls back to , with rendering handled via or direct Win32 calls, enabling compatibility through ports like MSYS2, , or bundled installers. For macOS, it employs CoreText for native font handling and for rendering, with installation available via Homebrew or tools. In Linux distributions, is widely pre-installed and packaged as libpango-1.0-0 or similar, ensuring seamless availability; for instance, it is included by default in , , and repositories, facilitating easy dependency resolution via package managers like apt or dnf. On Windows, integration occurs through development tools like for C++ projects, while macOS users rely on Homebrew for straightforward installation and updates. Cross-platform deployment of Pango faces challenges in maintaining rendering consistency, particularly with font fallback mechanisms that vary by operating system—such as differences in how on handles substitution compared to CoreText on macOS or Uniscribe on Windows—potentially leading to visual discrepancies in international text layout. Recent versions, including 1.57.0 (released September 2025), have introduced enhancements to backend modules for better modularity, though platform-specific font querying remains a point of complexity. Pango's licensing under the GNU Lesser General Public License (LGPL) version 2.1 or later permits its use in through both dynamic and static linking, provided that the library itself can be replaced or modified by users without altering the main application code. This flexibility supports broad adoption across commercial and open-source ecosystems while ensuring compliance with open-source principles.

References

  1. https://wiki.inkscape.org/wiki/Text_Rendering_Notes
Add your contribution
Related Hubs
User Avatar
No comments yet.