I’ve finally convinced myself that I need to make a Pango 2.0 release to clean up the API, and introduce some new APIs without breaking users that expect Pango to be very stable.
So, here it is… well not quite. What I am presenting today is not Pango 2.0 yet, but 1.90 – an unstable preview of the coming changes, to gather feedback and give some heads-up about whats coming.
Pango is now shipped as a single shared object, libpango-2.so, which contains the high-level cross-platform code as well as platform-specific fontmap implementations and the cairo support (if it is enabled). All of the APIs have been cleaned up and modernized.
PangoFontMap has seen some significant changes. It is now possible to instantiate a PangoFontMap, and populate it manually with PangoFontFamily and PangoFontFace objects.
There are still platform-specific subclasses
which will use platform APIs to enumerate fonts and populate the fontmap.
PangoLineBreaker is the core of pango’s line-breaking algorithm,
broken out from PangoLayout. Having this available independent
from PangoLayout will facilitate uses such as multi-column
layout, text flow between frames and shaping paragraphs around
Here is an example that shows changing the column width mid-paragraph:
PangoLines is the ‘formatted output’ part of a PangoLayout, and can be used to collect the output of a PangoLineBreaker.
PangoHbFont is a font implementation that is a thin wrapper around HarfBuzz font and face objects. This the way in which Pango handles fonts on all platforms now.
PangoUserFont is a callback-based font implementation to allow for entirely application-defined font handling, including glyph drawing. This is similar to cairo user fonts, where this example was borrowed:
Many smaller changes, such as better control over line height with line-height attributes and control over the trimming of leading, or guaranteed font ↔ description roundtrips with face-ids.
How can I try this?
The Pango code lives on the pango2 branch, and there is a corresponding pango2 branch of GTK, which contains a port of GTK to the new APIs.
The tarballs are here.
If you have an interest in text rendering, please try this out and tell us what you think. Your feedback will make Pango 2 better.
If you want to learn more about the history of Pango and the background for some of these changes, come to my Guadec talk in Guadalajara!