[cairo] Rendering line fonts

Ian Britten britten at caris.com
Tue Nov 18 11:55:43 PST 2008


Hi all,
I'm rendering text to Cairo via the FreeType/FT_Face interfaces.

As part of our previous (separate) work, we added support for our
own legacy/proprietary font format, by developing our own FT_Driver.
This allows our fonts to be accessed/used in our applications just
like any other FT_Face.

This is working, so long as the text is drawn via our own rendering
engine.  However, when I try to render the text via Cairo, I have a
rendering problem, due to the fact that our fonts may be composed
solely of lines, rather than filled polygons.
I've attached a small screenshot, showing the problematic output.

The crux of the problem is that FT seems to automatically close
any unclosed path drawn via FT_Outline_Decompose(), and turns
them into (filled) polygons.  Obviously, for a glyph that is
drawn as an open path (eg: "2"), the result is often a
self-intersecting, filled, blob.

When we are rendering/rasterizing the text ourselves, we handle
this case via special FT_Outline_Funcs.  However, now that I am
trying to render the text via Cairo, this issue is apparent again,
and our custom workaround is of no help.

This issue will likely end up being something I have to discuss
with the FT maintainers (Unless they're lurking here! ;-) , but I
wanted to get the impression of the Cairo developers too, in
case they can see any further problems.

So, I guess generally wondering stuff like:
- Is this solely between me and FT?
- Will text rendering this cause any problems for Cairo, by
   breaking any assumptions, etc?
- If there is no fix/change possible with FT, is there any way
   to handle this through Cairo?  (Hooks, etc).
- Will this cause any problems for PDF, SVG, or any other
   non-image backend?

Anyways, I know I've glossed over a lot of details for now - I'm
just trying to get a feel for how to best proceed.  If you have
any questions, or need more detail, please let me know!

Many thanks for any feedback/suggestions/etc!
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font.png
Type: image/png
Size: 2248 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20081118/737fd74f/attachment.png 


More information about the cairo mailing list