Re: pango: layout proposal


On 10/23/2009 12:42 PM, Ilia wrote:
Dear Sir.

Please excuse me for writing you directly. I am new to the open source
world, and do not know how it is usually done.

I want to switch our applications from GDI to Pango and Cairo because
these excellent libraries have many advantages. Currently, building
Pango layouts assumes equal space for all lines in the layout, which in
reality is often not the case. E.g. we generate a multi-page report, and
next page may have different space for the text flow. Currently, we
would have to find the first line which does not fit the page, and then
create layout for the next page, which causes text reallocation and
makes the cursor navigation over the lines more difficult. The situation
will become more complex if the text must flow around images.

*If* all lines have the same width, the way you do this is to walk the layout using a PangoLayoutIter and render each line whereever you wish.

It would be much more convenient, if we could adjust space width/height
and continue existing layout with a new box without text reallocation
and keeping the continuous cursor navigation.

Sounds like this bug:

Can you comment on the bug?

Another problem is ellipsizing paragraphs separately instead of per-box
basis. A beautiful solution would be if a function, which would allow us
ellipsizing the the last successfully-composed box explicitly, when we
find that the next box cannot be allocated.

Also, I was not able to find the answer on the following question. When
drawing a layout to a target cairo context, we must call
pango_cairo_update_layout() or the pair pango_cairo_update_context() +
pango_layout_context_changed() if the context is shared. This would
cause recalculation of the layout with repositioning glyphs and possibly
adding/removing ones in case of wrapping/ellipsizing. But how can I
compose everything to a printer and show it on a display even if it will
not look as nice as rendering to the display naturally, but would place
the glyphs exactly where they are expected?

pango_cairo_update_layout() calls pango_cairo_update_context() +

To get device-independent positioning, turn metrics hinting off in your cairo font options. There are a couple known bugs around this, but this should work if you don't use cairo_scale().


Thank you for your superior work.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]