[cairo] Rendering line fonts
Behdad Esfahbod
behdad at behdad.org
Tue Nov 18 14:07:09 PST 2008
Hi,
You are basically abusing the FreeType driver model to render stroke fonts
when it doesn't really support them. The best way to proceed is to use cairo
user fonts directly. See test/user-font.c in the cairo distribution for an
example, and read the user-fonts section of the docs. Failing that, you may
try to use cairo_glyph_path or cairo_text_path to get the outlines and process
yourself like you were doing previously.
behdad
Ian Britten wrote:
> 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
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list