Re: Device-independent text layout



On Wed, 2006-05-10 at 11:47 +0100, Damon Chaplin wrote:
> Hi,
> 
> For my goocanvas widget I really need device-independent text layout
> (i.e. the layout must remain the same on every monitor/printer and at
> any zoom setting).
> 
> By using the CAIRO_HINT_METRICS_OFF and CAIRO_HINT_STYLE_NONE font
> options it works OK 95% of the time, but there are still problems
> (mainly at small zoom settings < ~65%).
> 
> The glyph metrics still seem to change slightly at every zoom setting.
> I'm not sure exactly what is causing the changes, and if it is a bug or
> not.
> 
> So, firstly, is Pango supposed to currently support device-independent
> text layout? If so, how?
> 
> If not, one solution may be to add a "device-independent" option to
> PangoLayout. If set, it would do all line-breaking using the original
> font without any scaling (and using the original font metrics without
> any hinting). It would then do the actual layout using the real
> scaled/transformed font.
> 
> So we'd get a device-independent layout, though the line widths may be
> slightly incorrect (but for justified text we could adjust them).

Is the problem you are seeing just small errors from the conversion 

 font => device => user

? The use of fixed point coordinates will cause some small changes,
though I wouldn't expect noticeable problems until you had zoom factors
more like 1% than 65%.

(Poor rounding can make very small errors into big problems, so you
might want to investigate that...)

But are you really complaining about *metrics* problems, or is the
issue you are seeing is that text jitters as you try to animate it
rotating or scaling? If that's the problem you are seeing, then the
issue isn't metrics at all, but rather the lack of subpixel glyph
placement ... try switching from drawing with text, to converting the
text to a path and drawing that, and the problem should go away.

(At the expense of RGBA glyph rendering, and of speed...)

						Owen





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