summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-06-08 14:52:39 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-06-08 14:52:39 +0000
commit66921b4857c86d796ae62ae2de9d1bb27ec68fab (patch)
treea7b993c91a135e2dc2e528e5d687cc776bcedf64 /src/display
parentuse feed_pathvector_to_cairo in display/nr-arena-shape.cpp (diff)
downloadinkscape-66921b4857c86d796ae62ae2de9d1bb27ec68fab.tar.gz
inkscape-66921b4857c86d796ae62ae2de9d1bb27ec68fab.zip
use feed_pathvector_to_cairo in display/nr-svgfonts.cpp
(bzr r5851)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/nr-svgfonts.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp
index ebd71968b..42b321c8d 100644
--- a/src/display/nr-svgfonts.cpp
+++ b/src/display/nr-svgfonts.cpp
@@ -13,6 +13,8 @@
*/
#include <libnr/n-art-bpath.h>
+#include <2geom/pathvector.h>
+#include <2geom/transforms.h>
#include "../style.h"
#include <cairo.h>
#include <vector>
@@ -223,19 +225,23 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t *scaled_font,
//glyphs can be described by arbitrary SVG declared in the childnodes of a glyph node
// or using the d attribute of a glyph node.
- // bpath stores the path description from the d attribute:
- NArtBpath *bpath = NULL;
- if (SP_IS_GLYPH(node) && ((SPGlyph*)node)->d) bpath = sp_svg_read_path(((SPGlyph*)node)->d);
- if (SP_IS_MISSING_GLYPH(node) && ((SPMissingGlyph*)node)->d) bpath = sp_svg_read_path(((SPMissingGlyph*)node)->d);
+ // pathv stores the path description from the d attribute:
+ Geom::PathVector pathv;
+ if (SP_IS_GLYPH(node) && ((SPGlyph*)node)->d) {
+ pathv = sp_svg_read_pathv(((SPGlyph*)node)->d);
+ } else if (SP_IS_MISSING_GLYPH(node) && ((SPMissingGlyph*)node)->d) {
+ pathv = sp_svg_read_pathv(((SPMissingGlyph*)node)->d);
+ } else {
+ return CAIRO_STATUS_SUCCESS; // FIXME: is this the right code to return?
+ }
- if (bpath){
- //This glyph have a path description on its d attribute, so we render it:
- cairo_new_path(cr);
- NR::scale s(1.0/((SPFont*) node->parent)->horiz_adv_x);
- NR::Matrix t(s);
- NRRect area(0,0,1,1); //I need help here!
- feed_curve_to_cairo (cr, bpath, t, area.upgrade(), false, 0);
- cairo_fill(cr);
+ if (!pathv.empty()){
+ //This glyph has a path description on its d attribute, so we render it:
+ cairo_new_path(cr);
+ Geom::Scale s(1.0/((SPFont*) node->parent)->horiz_adv_x);
+ NRRect area(0,0,1,1); //I need help here!
+ feed_pathvector_to_cairo (cr, pathv, s, area.upgrade(), false, 0);
+ cairo_fill(cr);
}
//TODO: render the SVG described on this glyph's child nodes.