diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index cf3c7243299f20fcb814acf9b089cec25058f92d..066324ebf96a2ee1145702625fdc0c81c4b99793 100644 (file)
CairoRenderContext::CairoRenderContext(CairoRenderer *parent) :
_dpi(72),
- _pdf_level(0),
+ _pdf_level(1),
_ps_level(1),
_eps(false),
_is_texttopath(FALSE),
#ifdef CAIRO_HAS_PDF_SURFACE
case CAIRO_SURFACE_TYPE_PDF:
surface = cairo_pdf_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height);
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0))
+ cairo_pdf_surface_restrict_to_version(surface, (cairo_pdf_version_t)_pdf_level);
+#endif
break;
#endif
#ifdef CAIRO_HAS_PS_SURFACE
return FALSE;
}
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2))
- cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level);
- cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps);
+ cairo_ps_surface_restrict_to_level(surface, (cairo_ps_level_t)_ps_level);
+ cairo_ps_surface_set_eps(surface, (cairo_bool_t) _eps);
#endif
break;
#endif
@@ -1120,11 +1123,11 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPLinearGradient *lg=SP_LINEARGRADIENT(paintserver);
- sp_gradient_ensure_vector(SP_GRADIENT(lg)); // when exporting from commandline, vector is not built
+ SP_GRADIENT(lg)->ensureVector(); // when exporting from commandline, vector is not built
Geom::Point p1 (lg->x1.computed, lg->y1.computed);
Geom::Point p2 (lg->x2.computed, lg->y2.computed);
- if (pbox && SP_GRADIENT(lg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
+ if (pbox && SP_GRADIENT(lg)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
Geom::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
p1 *= bbox2user;
@@ -1144,12 +1147,12 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPRadialGradient *rg=SP_RADIALGRADIENT(paintserver);
- sp_gradient_ensure_vector(SP_GRADIENT(rg)); // when exporting from commandline, vector is not built
+ SP_GRADIENT(rg)->ensureVector(); // when exporting from commandline, vector is not built
Geom::Point c (rg->cx.computed, rg->cy.computed);
Geom::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
- if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
+ if (pbox && SP_GRADIENT(rg)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
apply_bbox2user = true;
// create radial gradient pattern
@@ -1172,7 +1175,7 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPGradient *g = SP_GRADIENT(paintserver);
// set extend type
- SPGradientSpread spread = sp_gradient_get_spread(g);
+ SPGradientSpread spread = g->fetchSpread();
switch (spread) {
case SP_GRADIENT_SPREAD_REPEAT: {
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
cairo_set_source_rgba(_cr, rgb[0], rgb[1], rgb[2], alpha);
} else {
- g_assert( style->fill.isPaintserver()
+ g_assert( style->stroke.isPaintserver()
|| SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style))
|| SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style)) );
@@ -1477,18 +1480,19 @@ CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoG
glyphs = (cairo_glyph_t*)g_malloc(sizeof(cairo_glyph_t) * num_glyphs);
unsigned int num_invalid_glyphs = 0;
- unsigned int i = 0;
+ unsigned int i = 0; // is a counter for indexing the glyphs array, only counts the valid glyphs
for (std::vector<CairoGlyphInfo>::const_iterator it_info = glyphtext.begin() ; it_info != glyphtext.end() ; it_info++) {
// skip glyphs which are PANGO_GLYPH_EMPTY (0x0FFFFFFF)
// or have the PANGO_GLYPH_UNKNOWN_FLAG (0x10000000) set
if (it_info->index == 0x0FFFFFFF || it_info->index & 0x10000000) {
TRACE(("INVALID GLYPH found\n"));
+ g_message("Invalid glyph found, continuing...");
num_invalid_glyphs++;
continue;
}
- glyphs[i - num_invalid_glyphs].index = it_info->index;
- glyphs[i - num_invalid_glyphs].x = it_info->x;
- glyphs[i - num_invalid_glyphs].y = it_info->y;
+ glyphs[i].index = it_info->index;
+ glyphs[i].x = it_info->x;
+ glyphs[i].y = it_info->y;
i++;
}