Comment 129 for bug 32561

Revision history for this message
In , Mozilla-behdad (mozilla-behdad) wrote :

(In reply to comment #47)
> > - Unless you use Pango the way it is supposed to be used,
>
> The problem is that the way it's "supposed" to be used isn't very compatible
> with rendering web content. Consider, for example, trying to render the
> following simple HTML + CSS with pango:
>
> <div> This is
> <span style="letter-spacing: 0.5em">so<span
> style="font-size: large">me</span> text</span>
> that has simple styling.
> </div>
>
> (this is not particularly contrived markup; in the "real" world you get stuff
> like this all the time, esp. with font changes).
>
> Pango seems to assume that what you're rendering are large paragraphs of text,
> all with the same styling. For a typical website, that's not what's being
> rendered....

Not at all. First, Pango has two levels of API. 1) PangoLayout, 2) bare pango_itemize, pango_shape, pango_break. And both of these support all the styling in your example. Slightly different perhaps, but quite possible to match. Pango supports that using attributes. It even has a convenience markup language. In Pango markup speak, your example can be rendered using:

  pango-view --markup --text 'This is <span letter_spacing="6144">so<span size="large">me</span> text</span> that has simple styling.'

The letter-spacing attribute in Pango takes an absolute size, but that's something that can be fixed if need be.