Re: [Inkscape-devel] Re: [cairo] Pango + cairo
[ 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
On Thu, Mar 17, 2005 at 07:05:47PM +1100, Owen Taylor wrote:
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.
Hi Owen,
Could you give a pointer to this patch? Sounds interesting.
Thanks, Bryce
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.
You may like to look at the documentation for what I've written at http://www.inkscape.org/doc/doxygen/html/classInkscape_1_1Text_1_1Layout.php which should give an idea of the sort of things a graphics application needs out of a text layout library. As you have already commented, the amount of code taken up by the layout engine is smaller than the ancilliary IO stuff. While looking at the functions that are available, you should be aware that several of them only exist because I thought they would be useful, not because I actually had a use in mind.
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.
Actually, I don't have any concrete plans to do non-greedy line breaking for Inkscape. The code I replaced did have a Knuth-Plass implementation, but it only worked for simpler shapes. The SVG spec specifies greedy.
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.
Again, you might like to look at the interface I'm using for that. It's in C++ of course, but it is a working example of one way to do it. http://www.inkscape.org/doc/doxygen/html/classInkscape_1_1Text_1_1Layout_1_1...
Richard.
participants (3)
-
Bryce Harrington
-
Owen Taylor
-
Richard Hughes