Re: Pango crossplatform layout size query

On 03/29/2010 11:33 PM, Richard Procter wrote:

>> Your best bet is to use the FreeType backend on all
>> systems.  And even then, same version of FreeType and cairo and pango...
> I suspected as much; thanks for confirming. As the freetype backend is
> deprecated,
> though, that is not a viable option for me over the longer term (*).
> This all implies
> that cairo/pango is not designed for applications that require invariant
> text extents
> across platforms.

My bad.  Let me clarify: Your best bet is to use pangocairo with cairo's
FreeType+Fontconfig font backend.  Not the pangoft2 backend.

> Presumably it is possible, though, as there are applications that do it.
> The
> English text extents of a PDF for example are identical between OS X 10.4
> Preview and Acrobat 5.0 on an old Windows 2000 machine, despite the lack of
> subpixel rendering on the later. SVG would also be largely useless for UML
> diagrams (perhaps it is?) without cross-platform text extent guarantees.

PDF stores the exact glyph locations.  The layout is not done during the
rendering but when the PDF is produced.

> For example, SVG text rendered in Firefox 3.6.2 using the same Arial
> font file
> does fit nicely within the same fixed-size box across OS X 10.4 and
> Windows 2000
> (at least, English text does; Hebrew and Arabic show more varied
> results), whereas the width of the HTML text varies. Obviously, the SVG
> renderer
> is doing something different.

Sure, you can try turning metrics hinting off.  That should give you fairly
robust results.

> I am obviously fairly ignorant about this stuff. Can anyone recommend a
> reference
> for these sorts of design issues? I have read the freetype and pango
> documentation.

There's not really much.

> Lastly, if anyone has any pointers on how to layout text for UML-like
> diagrams using
> cairo (via pango or something else) such that at least English text can
> be guaranteed
> to stay within its box across platforms, I'd really appreciate them -
> even if it's to say
> 'my friend, you're a madman; that's crazy talk'.

What do you my by "its box"?  If you have a presized box, you can rescale text
to fit within it.  That's an application-side algorithm you can easily implement.


> best regards,
> Richard.
> *
>> "That's what the pangoft2 backend does. Check the pango_ft2_* functions.
>> However, I don't recommend using that backend anymore. The only
>> *supported*
>> backend at this time is pangocairo, and the only one seeing future
>> development."
> _______________________________________________
> gtk-i18n-list mailing list
> gtk-i18n-list gnome org

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