From: Tony G. <Ton...@Su...> - 2005-08-05 16:19:40
|
Giacomo Cariello <jw...@bu...> writes: > Dear xmlroff list, > I'm posting here a brief summary of what I found out recently regarding > justification of paragraphs (sorry Tony, I didn't notice your request at > first, due to scrolling-hurry): Thanks, Giacomo, for bringing this back to the list. > 1) Since Pango didn't support justification natively, Damon Chaplin has > written a patch which adds justification, however the initial patch had > some problems, so he sent me a new one which should be almost final (in > attachment). The full justification story can be found here: > http://bugzilla.gnome.org/show_bug.cgi?id=64538 > > 2) After applying the above patch, xmlroff could be modified to support > justification, so I wrote a small patch (in attachment). Please notice > that text-alignment and direction is still in early stage and most > combinations aren't supported. I suppose xmlroff needs some kind of > masterplan to face all the possible orientations/alignments. I'm willing > to contribute, however I need some time and training on pango etc. ;-) > > 3) The result isn't completely satisfactory due to the following problem: > > (pseudo-quoting from a private mail to Tony Graham) > > ---> snip <--- > > When a 3-line paragraph is compressed into a 2-line paragraph, the > following assertion shows up: > > process:26210): libfo-CRITICAL **: fo_doc_gp_do_callbacks: assertion > `line_last >= line_first && line_last <= g_slist_length > (pango_layout_get_lines (layout)) - 1' failed > > (process:26210): libfo-CRITICAL **: fo_doc_gp_do_callbacks: assertion > `line_last >= line_first && line_last <= g_slist_length > (pango_layout_get_lines (layout)) - 1' failed > > and an empty line is > showed after the paragraph. I suppose for some reason the real number of > lines isn't updated correctly. Damon tells me that he doesn't experience > the above problem using pango with GtkTextView widget, so could you > please verify how/when lines count are fetched from pango and what > actually happens if pango returns a shorter line count? > > ---> snip <--- > > Tony answers that: > > ---> snip <--- ... > I suspect that xmlroff is getting a count of the lines before the > justification code removes the last line. You should set the justification in fo/fo-block-area.c, somewhere near this comment: /* FIXME: Pango does not justify. fo_layout_set_justify (pango_layout, TRUE); */ (Although the variable should be 'fo_layout' now, not 'pango_layout'.) You could presumably add add a parameter to configure.in to set a #define in config.h to control an #ifdef in fo_layout_set_justify() to control whether pango_set_justify() or pango_set_justification() would be called. Any use of Damon's patch would have to be optional until such time as it becomes part of Pango. I have spent more time than I care to recall working on modified versions of Pango and trying to keep them up to date with the real Pango -- partly because of an original decision to use PDFlib because of limitations in GNOME Print back in 2001 and partly because of trying out additional XSL-specific properties -- always with the best of intentions of getting my additions into core Pango. The current PangoXSL attempts much less than did the original PangoPDF because Pango and GNOME Print finally worked well together, and it's been a relief to not have to maintain an almost-Pango. It is also tempting to try adding a Cairo backend to xmlroff to use the new Cairo support in Pango, and I have to keep telling myself that I need to work on xmlroff rather than spend more time chasing changes in Pango. However, if someone else wants to work on it, I (and the other committers, I'm sure) would be happy to accept patches. Regards, Tony. |