[cairo] About cairo_show_text and UTF-8...
Carl Worth
cworth at cworth.org
Fri Jan 6 11:34:52 PST 2006
On Fri, 06 Jan 2006 13:54:48 -0500, Scott Robert Ladd wrote:
>
> I was trying to display a single non-ASCII character, and to invoke
> Pango seems like excessive complication for a simple task.
You don't have to invoke pango to display your single non-ASCII
character. Cairo will do it just fine, even with cairo_show_text. The
only trick (currently) is that you must first ensure that you have
selected a font that contains a glyph for the character you are trying
to display[*].
> By calling it a "toy", Cairo implies that there are only two types of
> apps: those that display exceptionally simple text, and those that need
> the power of a full WYSIWYG word processor.
That's actually not the distinction I have in mind when I talk about
the toy text API. And the "toy" name isn't preventing anyone adding
font substitution to cairo_show_text. As I indicated above, I'd be
glad to accept improvements to the implementation of cairo_show_text
to do exactly what you want.
The "toy" aspect of cairo_show_text is an admission on our part that
its behavior with regards to text layout is wholly inadequate for most
of the world's text systems.
> Also, the Cairo documentation (which is *very* sparse, and somewhat
> incomplete) implies that cairo_show_text is more capable than it is, by
> stating that it supports UTF-8 when it really does not.
Yes, the documentation is still quite inadequate. I will be the first
to admit that. And I am embarrassed that we have had "1.0" out for
this long and still haven't finished the documentation.
But the note about UTF-8 is correct. That is the only encoding of text
that is supported by cairo_show_text. What is missing in the
documentation is an indication about the current limitation of only
displaying glyphs from the currently selected font.
-Carl
[*] Cairo does not provide much direct help in terms of finding such a
font. For that job, you will have to reach down into the native font
system, (or else access some other library that does so).
There might very well be a good place for a companion library to cairo
to help with this job. (And for many uses, pango might be perfectly
adequate as that companion library.) In any case, the missing pieces
here are on the same order of difficulty as cairo itself, so I don't
think it makes sense to expand cairo's role to try to include
them. (As you noted, we're already behind enough as it is.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060106/2a0112ee/attachment.pgp
More information about the cairo
mailing list