summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-07-08 20:19:51 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-07-08 20:19:51 +0000
commit833b51652c32d5b9212246252a2c35a8c0ac5143 (patch)
treebdd2c1c8fbe5d2fbe918e6f1558b458b12155137 /src
parent2geomify SPCurve::new_from_rect (diff)
downloadinkscape-833b51652c32d5b9212246252a2c35a8c0ac5143.tar.gz
inkscape-833b51652c32d5b9212246252a2c35a8c0ac5143.zip
render glyphs using 2geom pathvector instead of artbpath of font-glyph
(bzr r6236)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-arena-glyphs.cpp18
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp22
2 files changed, 19 insertions, 21 deletions
diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp
index 7ca6d9aa1..9295beccd 100644
--- a/src/display/nr-arena-glyphs.cpp
+++ b/src/display/nr-arena-glyphs.cpp
@@ -21,6 +21,8 @@
#include <libnr/n-art-bpath.h>
#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-fns.h>
+#include <libnr/nr-convert2geom.h>
+#include <2geom/matrix.h>
#include "../style.h"
#include "nr-arena.h"
#include "nr-arena-glyphs.h"
@@ -462,11 +464,11 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
for (child = group->children; child != NULL; child = child->next) {
NRArenaGlyphs *g = NR_ARENA_GLYPHS(child);
- NArtBpath *bpath = (NArtBpath *) g->font->ArtBPath(g->glyph);
+ Geom::PathVector const * pathv = g->font->PathVector(g->glyph);
cairo_new_path(ct);
- NR::Matrix g_t(g->g_transform);
- feed_curve_to_cairo (ct, bpath, g_t * group->ctm, (pb->area).upgrade(), false, 0);
+ Geom::Matrix transform = to_2geom(g->g_transform * group->ctm);
+ feed_pathvector_to_cairo (ct, *pathv, transform, (pb->area).upgrade(), false, 0);
cairo_fill(ct);
pb->empty = FALSE;
}
@@ -610,15 +612,13 @@ void
nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NR::Matrix const *transform)
{
NRArenaGroup *group;
- NRBPath bpath;
group = NR_ARENA_GROUP(sg);
- bpath.path = ( font
- ? (NArtBpath *) font->ArtBPath(glyph)
- : NULL );
- if ( bpath.path ) {
-
+ Geom::PathVector const * pathv = ( font
+ ? font->PathVector(glyph)
+ : NULL );
+ if ( pathv ) {
nr_arena_item_request_render(NR_ARENA_ITEM(group));
NRArenaItem *new_arena = NRArenaGlyphs::create(group->arena);
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index 499a8f7a5..eb6514b34 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -17,10 +17,12 @@
#include "livarot/Path.h"
#include "libnr/nr-matrix-fns.h"
#include "libnr/nr-scale-matrix-ops.h"
+#include "libnr/nr-convert2geom.h"
#include "font-instance.h"
#include "svg/svg-length.h"
#include "extension/internal/cairo-render-context.h"
#include "display/curve.h"
+#include <2geom/pathvector.h>
namespace Inkscape {
namespace Extension {
@@ -232,14 +234,11 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const
NR::Matrix glyph_matrix;
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
if (clip_mode) {
- NArtBpath *bpath = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph);
- if (bpath) {
- NArtBpath *abp = nr_artpath_affine(bpath, glyph_matrix);
- const_NRBPath bpath;
- bpath.path = abp;
+ Geom::PathVector const *pathv = span.font->PathVector(_glyphs[glyph_index].glyph);
+ if (pathv) {
+ Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix);
SPStyle const *style = text_source->style;
- ctx->renderPath(&bpath, style, NULL);
- g_free(abp);
+ ctx->renderPathVector(pathv_trans, style, NULL);
}
glyph_index++;
continue;
@@ -550,11 +549,10 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
Span const &span = _glyphs[glyph_index].span(this);
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
- NRBPath bpath;
- bpath.path = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph);
- if (bpath.path) {
- NArtBpath *abp = nr_artpath_affine(bpath.path, glyph_matrix);
- SPCurve *c = SPCurve::new_from_bpath(abp);
+ Geom::PathVector const * pathv = span.font->PathVector(_glyphs[glyph_index].glyph);
+ if (pathv) {
+ Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix);
+ SPCurve *c = new SPCurve(pathv_trans);
if (c) cc = g_slist_prepend(cc, c);
}
}