[Inkscape-devel] Re: [cairo] Pango + cairo

Owen Taylor otaylor at redhat.com
Wed Mar 16 20:17:26 PST 2005


[ Adding gtk-i18n-list to the CC, as more on-topic ]

[ ... Various comments about SVG text requirements snipped ... ]

On Thu, 2005-03-17 at 13:32 +1100, Peter Moulder wrote:

> > I believe that there is a place for a library supporting advanced text
> > applications, but that Pango Layout is not it. The overhead is really
> > quite large and seems unnecessary for an API whose primary goal is
> > laying out text in widgets.
> 
> Owen, can you comment on what you see as pango's scope?  Are you
> interested in non-rectangular text regions?  Are you interested in
> non-greedy line breaking?  (I'd guess that non-greedy line breaking
> would be desirable even for dialog boxes, at least from a functional
> point of view; the only question is whether it justifies the cost in
> terms of maintainability of pango code and perhaps code size.)

Pango's goal is to support anything anybody wants to do with text.

The scope is implicit in the fact that text is hard, and
internationalized text is harder. If you start from scratch and don't
use Pango, you either have to say "full international coverage is never
going to be interesting to me", or you have a year or two of work to
do to catch up to Pango.

So, the question isn't to me "what is Pango's scope" but rather what
parts of Pango should be universal, and what parts do you replace.
In particular, what about PangoLayout? It's really only a small part
of Pango's code - maybe 10-15% of the total 65,000 lines of code,
so maybe it's just ignorable? If you want non-rectangular line breaking,
just use the low level parts of Pango

My opinion is that while there may be some cases where ignoring
PangoLayout and starting from scratch is right ... we really want
PangoLayout to be extensible to handle almost any case where we
are taking a block of text and laying it out into lines. Because 
of the 8000 lines of code inside PangoLayout, the part that actually
lays out the text is only a small fraction ... 1000-2000 lines of
code. The rest is bookkeeping, rendering, iteration over the layout
and so forth.

There's a big patch from Damon Chaplin outstanding to redo the
line layout part of Pango to add justification. I haven't had the
time to fully review it yet. It's pretty darn complex. If it turns 
out that we can't just replace the current code wholesale, that patch
may be a good point to look at making line-layout pluggable.

Non-greedy linebreaking is very challenging to do with good
internationalized shaping. (I think Damon spent some time trying
to figure out and then gave up.) But if someone had a spare month,
I think it's definitely possible. And I wouldn't mind shipping
it with Pango, as long as it was optional. As well as performance
considerations, it is just the wrong behavior for most interactive
applications.

Non-rectangular layout, on the other hand, is pretty easy. It's
not totally trivial when you have mixed fonts within a line and
thus uneven line spacing, but I think the main challenge there is
simply coming up with a good interface for representing the shape
to Pango.

Regards,
						Owe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050316/70f5ba0a/attachment.pgp


More information about the cairo mailing list