<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Cairo in an embedded environment: removing fontconfig, 16-bit RGB,porting issues</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>I'm investigating using Cairo to provide rich 2D vector graphics<BR>
capabilities for our embedded OS for small devices. It does what we<BR>
need and so far seems to be fantastically easy to use.<BR>
<BR>
However, we have to modify it in several ways to get it to work<BR>
in our environment. Presumably some of these changes aren't of<BR>
interest to the general community, but others may be potentially<BR>
useful patches to roll back into the distro.<BR>
<BR>
So I have a lot of questions related to this, and was wondering<BR>
what people thought:<BR>
<BR>
<BR>
1. We already use FreeType, but we don't use fontconfig, and we don't<BR>
have the kind of complex file-based font system for which it would<BR>
be appropriate; nor do we want the extra code footprint associated<BR>
with fontconfig. Therefore, we're going to have to strip down the<BR>
FreeType font backend to take out those dependencies.<BR>
<BR>
Ned Konz of Squeak seems to have discussed something similar on the<BR>
mailing list a couple of years ago. I'm at a very early stage<BR>
messing with this, but my initial feelings about this are similar<BR>
to his: we already have our own mechanisms for font selection, so<BR>
we probably don't need fontconfig's. The only place where the<BR>
Cairo backend actually seems to *use* fontconfig's functionality is<BR>
under the toy text API, which is not necessarily of use to us.<BR>
<BR>
Might it be a good idea to try to disentangle the fontconfig-based<BR>
font selection/presentation stuff from the rest of the FreeType<BR>
backend? Are there known pitfalls associated with this approach?<BR>
<BR>
<BR>
2. We're using cairo-image-surface.c for a surface backend. While we<BR>
use several image formats internally, the native screen pixel<BR>
format on our platform tends to be 16-bit r5g6r5.<BR>
<BR>
Since pixman supports it, exposing it in Cairo is easy. I'm<BR>
guessing that other people working in an embedded space may be<BR>
interested in this, since it is a common color format on small<BR>
devices.<BR>
<BR>
It does bring up a naming question. Calling the format<BR>
CAIRO_FORMAT_RGB16 would work for now, but it's far from the only<BR>
16-bit format in use out there; x1r5g5b5 is also common, for<BR>
instance, and we may well need to support it in the future. I'm<BR>
tentatively calling our format CAIRO_FORMAT_RGB565. Should Cairo<BR>
go to some more expansive naming convention for color formats?<BR>
<BR>
<BR>
3. Our OS is not POSIX-compliant, though it has some similarities. We<BR>
also have a different build system that won't easily incorporate<BR>
the existing Cairo build process. This means many small changes to<BR>
header includes and #defines throughout Cairo and pixman, which may<BR>
be difficult and/or undesirable to roll back into the distribution.<BR>
So I'm assuming the Cairo project proper doesn't want this stuff.<BR>
<BR>
However, there are some changes that might make ports like this one<BR>
easier to do in the future (and make it easier for us to integrate<BR>
new Cairo versions), such as centralizing the POSIX header includes<BR>
under cairoint.h. That seems to be mostly already done in Cairo<BR>
proper (not so much in pixman) but there are exceptions, such as<BR>
several Cairo source files that directly include stdlib.h. Is<BR>
there a reason for this? Would changes to such things be<BR>
appreciated, or are there cross-platform build issues that make it<BR>
inadvisable?<BR>
<BR>
(How about pixman--is that a separate active project or is it under<BR>
the aegis of Cairo now?)<BR>
<BR>
<BR>
Any thoughts would be appreciated...<BR>
<BR>
Matt McIrvin<BR>
SavaJe Technologies<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>