[Cairo] Text API proposal

Thorsten Behrens thorsten.behrens at sun.com
Wed Jul 30 01:52:41 PDT 2003


Yesterday, Owen wrote:

> > We think that the layout framework and the generic text API need to be so
> > tightly coupled as to be indistinguishable for from the outside. When
> > native font subsystems like Win's Uniscribe or OSX's ATSUI are to be used,
> > it is very hard to separate them.
>
> Would you use Pango in OpenOffice.org on all platforms? Would
> use it if it was called CairoText? That's what you are proposing.
>
> [...]
>
>  - A low-level abstraction that can work with different font systems
>    like FreeType and Uniscribe. (Pango has a fully functioning
>    Uniscribe backend. There are some performance issues, but we
>    think they are incidental.)
>
Yes, that was our intention. Unless somebody proves it's no longer
necessary, using Uniscribe on Windows is more or less a requirement for
us. Currently, we use ICU for layouting and other stuff, but (at least in
principle) we think there's no problem with Pango.

> The question of how you can use "Pango" and Cairo together on top
> of something other than FreeType is indeed an interesting one
> and one that needs to be handled if GTK+ is going to use Cairo
> as it's rendering API.
>
Exactly. And one that should maybe figured out before the APIs become too
finalized.

> I don't see how putting a Pango equivalent into Cairo really helps with
> that; the basic plan of a solution is:
>
>  - Figure out what operations Cairo needs from the font API
>    to implement it's low-level and toy APIs:
>
>     - Load a font from a name
>     - Scale/Apply a transformation matrix to a font
>     - Convert Unicode text to glyphs
>     - Render a glyph to a bitmap
>     - Add a glyph to a cairo path
>
>  - Create virtualized CairoFontmap, CairoFont (or, I guess,
>    cairo_fontmap_t, cairo_font_t, ugh.) objects.
>
>  - Have functions for setting the CairoFontmap for a context
>
>  - Ship implementations of CairoFont* with Cairo for major
>    rendering systems. These would have functions like
>    CairoFont *cairo_fontconfig_font_new_for_pattern()
>    FT_Face cairo_fontconfig_font_lock_ft_face ().
>
> Then, as the person hooking together Cairo and Pango, then all
> I have to do is to write a little bit of glue to hook
> CairoFontconfigFont to PangoFontconfig and a bit of glue for hooking
> CairoWin32Font to PangoWin32.
>
That sounds reasonable. The only thing we need to use Cairo portably is a
high-level text interface. Do you still think that the proposed Cairo
glyph render API suffices for Windows? As we've said, Uniscribe and glyph
output on Windows are extremely hard to separate.

Best regards,

-- 

Thorsten

"Historically speaking, the presence of wheels in Unix has never precluded
their reinvention." [Larry Wall]





More information about the cairo mailing list