Code

Set the even-odd clipping rule if requested
[inkscape.git] / src / extension / internal / pdfinput / svg-builder.cpp
index 9fc4fa766ab1e5f3f891d1d51791973d2b22bd3d..429a0cd4a542b328b16641be9836fc25e12be283 100644 (file)
@@ -401,6 +401,9 @@ void SvgBuilder::setClipPath(GfxState *state, bool even_odd) {
     gchar *pathtext = svgInterpretPath(state->getPath());
     path->setAttribute("d", pathtext);
     g_free(pathtext);
+    if (even_odd) {
+        path->setAttribute("clip-rule", "evenodd");
+    }
     clip_path->appendChild(path);
     Inkscape::GC::release(path);
     // Append clipPath to defs and get id
@@ -758,8 +761,10 @@ void SvgBuilder::updateFont(GfxState *state) {
     // Store original name
     if (font->getOrigName()) {
         _font_specification = font->getOrigName()->getCString();
-    } else {
+    } else if (font->getName()) {
         _font_specification = font->getName()->getCString();
+    } else {
+        _font_specification = "Arial";
     }
 
     // Prune the font name to get the correct font family name
@@ -784,7 +789,6 @@ void SvgBuilder::updateFont(GfxState *state) {
 
     // Font family
     if (font->getFamily()) {
-        const gchar *family = font->getFamily()->getCString();
         sp_repr_css_set_property(_font_style, "font-family", font->getFamily()->getCString());
     } else {
         sp_repr_css_set_property(_font_style, "font-family", font_family);
@@ -1072,8 +1076,6 @@ void SvgBuilder::beginString(GfxState *state, GooString *s) {
     }
     IFTRACE(double *m = state->getTextMat());
     TRACE(("tm: %f %f %f %f %f %f\n",m[0], m[1],m[2], m[3], m[4], m[5]));
-    IFTRACE(m = _current_font->getFontMatrix());
-    TRACE(("fm: %f %f %f %f %f %f\n",m[0], m[1],m[2], m[3], m[4], m[5]));
     IFTRACE(m = state->getCTM());
     TRACE(("ctm: %f %f %f %f %f %f\n",m[0], m[1],m[2], m[3], m[4], m[5]));
 }
@@ -1092,6 +1094,8 @@ void SvgBuilder::addChar(GfxState *state, double x, double y,
     bool is_space = ( uLen == 1 && u[0] == 32 );
     // Skip beginning space
     if ( is_space && _glyphs.size() < 1 ) {
+        NR::Point delta(dx, dy);
+         _text_position += delta;
          return;
     }
     // Allow only one space in a row