[cairo] PangoCairo plans requiring cairo API
Behdad Esfahbod
behdad at behdad.org
Tue May 27 17:49:59 PDT 2008
Hi,
Thought I write about my near-term PangoCairo plans that need api
changes in cairo.
Bug 527005 – Add pango_cairo_show_text()?
http://bugzilla.gnome.org/show_bug.cgi?id=527005
The idea here is to add a pangocairo drop-in replacement for
cairo_show_text. It will take font options, font matrix, ctm, and font
face cairo_t. The hard part is how to use the font face. When I fix
pango to use a given cairo_font_face_t (next item), that would work.
But when the current font face on cairo_t is a toy font face, it makes
no sense to make pango use it, as this would provide no added value to
using cairo_show_text() directly. What would be useful however, is if
Pango could get the family, slant, and weight values passed to
cairo_select_font() and use those to choose fonts. That's why I
proposed cairo_toy_font_face_get_* API recently:
http://lists.cairographics.org/archives/cairo/2008-May/014206.html
The cairo_toy_font_face_create() proposed there is also useful when
Pango wants to use cairo's toy text api as a failsafe fallback means to
render text.
Bug 347237 – Making Pango use a given cairo_font_face_t
http://bugzilla.gnome.org/show_bug.cgi?id=347237
This is the most wanted pangocairo feature at this time. To make it
really useful, we need generic font-face constrcutors like
cairo_font_face_create_from_file/stream/memory() too. It would then be
trivial to use application-provided fonts with pangocairo.
Bug 469091 – Get rid of pango_cairo_update_context() and pango_cairo_update_layout()
http://bugzilla.gnome.org/show_bug.cgi?id=469091
This requires a single API:
int cairo_serial (cairo_t *cr);
The serial number is part of the gstate and will be increased everytime
a property changes on cairo_t. Serial number is pushed/popped in
gstate, but the "next serial" value lives in the cairo_t itself. The
idea is that Pango can compare serial number of a cairo_t to
shortcircuit detecting changes. Rendering to a different cairo_t still
needs calling _update_().
===========================
Other text-related suggestions:
- With user-fonts wanting to act as proxies using other fonts, we need
to access text_to_glyphs() functionality of arbitrary fonts. That calls
for a cairo_scaled_font_text_to_glyphs(). Perhaps an advanced version
accommodating cairo_show_text_glyphs() semantics.
- A way to appoint a function to create toy font faces. This can be
used to plug pango into the toy text api, making it actually a useful
thing.
- Add the twin stroke font an internal failsafe font (implemented as a
user-font) that can be selected by passing NULL to
cairo_select_font_face().
- When the above changes is done, we can let cairo be usefully compiled
with no font backends at all.
Cheers,
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list