Sorry for a late response, but I thought I need to comment on this...
On Tue, May 13, 2008 at 5:29 PM, Richard Hughes <cyreve@...400...> wrote:
There are probably three components involved:
- The text layout stuff in libnrtype/, which I have described to you
already
- livarot/, which is a computational library providing curve and shape
manipulation, including some of the backend support for rasterisation. The path manipulation parts of livarot are in the process of being rewritten as lib2geom.
- display/, which is the controller for rasterising shapes and
presenting them to the canvas. Large chunks of this should get replaced by calls to Cairo.
The important point is that cairo is already used for text when you're in Outline mode. It simply takes the glyphs as paths and renders them using cairo's path calls. So no cairo text handling is involved at all. Here's where the text outlines are obtained in nr_arena_glyphs_group_render:
NArtBpath *bpath = (NArtBpath *) g->font->ArtBPath(g->glyph);
where g->font is font_instance*. Therefore, all the pango magic, figuring out glyphs etc. is apparently all done within font_instance. Sure I'd prefer to keep it that way, as it will make cairofication of the main rendering easier. But if you have reasons to change that, please feel free to discuss that.
- does that mean we need to replace livarot? How to proceed?
Eventually yes, as it is very hard to maintain - hairy code, unfixable bugs etc.
Yes, but that's not your job. The difficulty is that the text code spits out these Path and Shape types, which are not at all conducive to being fed into Cairo.
Actually it also spits out NArtBpath*, which is then easy to feed to cairo, as the above shows
It is interesting to note, however, that you'll have to change the Path/Shape stuff anyway even if you don't go with Cairo because user glyphs can be so much more than just style+outline: they can be entire groups of multicoloured objects.
Path and Shape classes eventually should be eliminated in favor of 2geom path representation and/or NArtBpath which has an easy 1:1 mapping to 2geom (or so I was told by Johan).
"Getting text layout to use Cairo for output rather than libnr."
Can you show me where does that output reside in the code?
libnrtype/FontInstance.cpp, RasterFont.cpp
I'm not sure this is what was asked here - output is actually in nr-arena-glyphs and it already uses cairo in outline mode, changing it to use it for normal mode too will be easy. Again, all we need is a way to get the path outlines from font_instance or some equivalent.