From 5b5cb1452e907aa477f59824493c7f9938f1aa85 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Tue, 8 Jul 2008 20:19:51 +0000 Subject: [PATCH] render glyphs using 2geom pathvector instead of artbpath of font-glyph --- src/display/nr-arena-glyphs.cpp | 18 +++++++++--------- src/libnrtype/Layout-TNG-Output.cpp | 22 ++++++++++------------ 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 #include #include +#include +#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); } } -- 2.30.2