diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-03-14 16:37:50 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2016-03-14 16:37:50 +0000 |
| commit | b8d22beef5345210ad27cdc2685083aeae6f8f3b (patch) | |
| tree | d69b8bfd19d3627a8425a1b265c2abf229b05354 /src/extension | |
| parent | fixes for update to trunk (diff) | |
| parent | "Relative to" option for node alignment. (diff) | |
| download | inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.tar.gz inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.zip | |
update to trunk
(bzr r13708.1.39)
Diffstat (limited to 'src/extension')
23 files changed, 335 insertions, 387 deletions
diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 29c2b5537..31491605b 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -30,8 +30,6 @@ #include "display/sp-canvas.h" -#include "util/glib-list-iterators.h" - namespace Inkscape { namespace Extension { @@ -61,7 +59,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp if (desktop != NULL) { std::vector<SPItem*> selected = desktop->getSelection()->itemList(); - for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); x++){ + for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id = (*x)->getId(); _selected.insert(_selected.end(), selected_id); diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index b0ff3e91c..92a8a2833 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -23,7 +23,6 @@ #include "desktop.h" #include "ui/view/view.h" -#include "util/glib-list-iterators.h" namespace Inkscape { namespace Extension { diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e07a3963c..4cb0c9b73 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -41,8 +41,12 @@ #include "ui/view/view.h" #include "xml/node.h" #include "xml/attribute-record.h" +#include "ui/tools/node-tool.h" +#include "ui/tool/multi-path-manipulator.h" +#include "ui/tool/path-manipulator.h" +#include "ui/tool/control-point-selection.h" + -#include "util/glib-list-iterators.h" #include "path-prefix.h" #ifdef WIN32 @@ -310,9 +314,9 @@ bool Script::load(Inkscape::Extension::Extension *module) const gchar *interpretstr = child_repr->attribute("interpreter"); if (interpretstr != NULL) { std::string interpString = resolveInterpreterExecutable(interpretstr); - command.insert(command.end(), interpString); + command.push_back(interpString); } - command.insert(command.end(), solve_reldir(child_repr)); + command.push_back(solve_reldir(child_repr)); } if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "helper_extension")) { helper_extension = child_repr->firstChild()->content(); @@ -691,13 +695,56 @@ void Script::effect(Inkscape::Extension::Effect *module, std::vector<SPItem*> selected = desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer - for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); x++){ + for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id += "--id="; selected_id += (*x)->getId(); - params.insert(params.begin(), selected_id); + params.push_front(selected_id); } + {//add selected nodes + Inkscape::UI::Tools::NodeTool *tool = 0; + if (SP_ACTIVE_DESKTOP ) { + Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; + if (INK_IS_NODE_TOOL(ec)) { + tool = static_cast<Inkscape::UI::Tools::NodeTool*>(ec); + } + } + + if(tool){ + Inkscape::UI::ControlPointSelection *cps = tool->_selected_nodes; + for (Inkscape::UI::ControlPointSelection::iterator i = cps->begin(); i != cps->end(); ++i) { + Inkscape::UI::Node *node = dynamic_cast<Inkscape::UI::Node*>(*i); + if (node) { + std::string id = node->nodeList().subpathList().pm().item()->getId(); + + int sp = 0; + bool found_sp = false; + for(Inkscape::UI::SubpathList::iterator i = node->nodeList().subpathList().begin(); i != node->nodeList().subpathList().end(); ++i,++sp){ + if(&**i == &(node->nodeList())){ + found_sp = true; + break; + } + } + int nl=0; + bool found_nl = false; + for (Inkscape::UI::NodeList::iterator j = node->nodeList().begin(); j != node->nodeList().end(); ++j, ++nl){ + if(&*j==node){ + found_nl = true; + break; + } + } + std::ostringstream ss; + ss<< "--selected-nodes=" << id << ":" << sp << ":" << nl; + Glib::ustring selected = ss.str(); + + if(found_nl && found_sp)params.push_front(selected); + else g_warning("Something went wrong while trying to pass selected nodes to extension. Please report a bug."); + } + } + } + }//end add selected nodes + file_listener fileout; int data_read = execute(command, params, dc->_filename, fileout); fileout.toFile(tempfilename_out); @@ -1014,6 +1061,8 @@ int Script::execute (const std::list<std::string> &in_command, } } + //for(int i=0;i<argv.size(); ++i){printf("%s ",argv[i].c_str());}printf("\n"); + int stdout_pipe, stderr_pipe; try { diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index bc0dd8e33..a235dcb0f 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -24,7 +24,6 @@ #include "selection.h" #include "sp-object.h" -#include "util/glib-list-iterators.h" #include "extension/effect.h" #include "extension/system.h" @@ -79,7 +78,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems = new SPItem*[selectCount]; // Loop through selected items - for (std::vector<SPItem*>::const_iterator i = selectedItemList.begin(); i != selectedItemList.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = selectedItemList.begin(); i != selectedItemList.end(); ++i) { SPItem *item = *i; Inkscape::XML::Node *node = reinterpret_cast<Inkscape::XML::Node *>(item->getRepr()); if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 9f19f8b3b..0e3aa98ce 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -22,8 +22,6 @@ #include "path-chemistry.h" #include "sp-item.h" -#include "util/glib-list-iterators.h" - #include "extension/effect.h" #include "extension/system.h" diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index c3e416184..5d8b0e076 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -130,14 +130,12 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _clip_mode(CLIP_MODE_MASK), _omittext_state(EMPTY) { - font_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, font_data_free); } CairoRenderContext::~CairoRenderContext(void) { - if(font_table != NULL) { - g_hash_table_remove_all(font_table); - } + for (std::map<gpointer, cairo_font_face_t *>::const_iterator iter = font_table.begin(); iter != font_table.end(); ++iter) + font_data_free(iter->second); if (_cr) cairo_destroy(_cr); if (_surface) cairo_surface_destroy(_surface); @@ -1182,7 +1180,7 @@ CairoRenderContext::_createHatchPainter(SPPaintServer const *const paintserver, std::vector<SPHatchPath *> children(evil->hatchPaths()); for (int i = 0; i < overflow_steps; i++) { - for (std::vector<SPHatchPath *>::iterator iter = children.begin(); iter != children.end(); iter++) { + for (std::vector<SPHatchPath *>::iterator iter = children.begin(); iter != children.end(); ++iter) { SPHatchPath *path = *iter; _renderer->renderHatchPath(pattern_ctx, *path, dkey); } @@ -1247,11 +1245,12 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain Geom::Point c (rg->cx.computed, rg->cy.computed); Geom::Point f (rg->fx.computed, rg->fy.computed); double r = rg->r.computed; + double fr = rg->fr.computed; if (pbox && SP_GRADIENT(rg)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) apply_bbox2user = true; // create radial gradient pattern - pattern = cairo_pattern_create_radial(f[Geom::X], f[Geom::Y], 0, c[Geom::X], c[Geom::Y], r); + pattern = cairo_pattern_create_radial(f[Geom::X], f[Geom::Y], fr, c[Geom::X], c[Geom::Y], r); // add stops for (gint i = 0; unsigned(i) < rg->vector.stops.size(); i++) { @@ -1454,8 +1453,11 @@ CairoRenderContext::_prepareRenderText() } } +/* We need CairoPaintOrder as markers are rendered in a separate step and may be rendered + * inbetween fill and stroke. + */ bool -CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle const *style, Geom::OptRect const &pbox) +CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle const *style, Geom::OptRect const &pbox, CairoPaintOrder order) { g_assert( _is_valid ); @@ -1477,9 +1479,10 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con return true; } - bool no_fill = style->fill.isNone() || style->fill_opacity.value == 0; + bool no_fill = style->fill.isNone() || style->fill_opacity.value == 0 || + order == STROKE_ONLY; bool no_stroke = style->stroke.isNone() || style->stroke_width.computed < 1e-9 || - style->stroke_opacity.value == 0; + style->stroke_opacity.value == 0 || order == FILL_ONLY; if (no_fill && no_stroke) return true; @@ -1493,14 +1496,17 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con pushLayer(); if (!no_fill) { - _setFillStyle(style, pbox); - setPathVector(pathv); - if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); } + } + + setPathVector(pathv); + + if (!no_fill && (order == STROKE_OVER_FILL || order == FILL_ONLY)) { + _setFillStyle(style, pbox); if (no_stroke) cairo_fill(_cr); @@ -1510,10 +1516,17 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con if (!no_stroke) { _setStrokeStyle(style, pbox); - if (no_fill) - setPathVector(pathv); - cairo_stroke(_cr); + if (no_fill || order == STROKE_OVER_FILL) + cairo_stroke(_cr); + else + cairo_stroke_preserve(_cr); + } + + if (!no_fill && order == FILL_OVER_STROKE) { + _setFillStyle(style, pbox); + + cairo_fill(_cr); } if (need_layer) @@ -1643,9 +1656,11 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma return true; // create a cairo_font_face from PangoFont - double size = style->font_size.computed; /// \fixme why is this variable never used? + // double size = style->font_size.computed; /// \fixme why is this variable never used? gpointer fonthash = (gpointer)font; - cairo_font_face_t *font_face = (cairo_font_face_t *)g_hash_table_lookup(font_table, fonthash); + cairo_font_face_t *font_face = NULL; + if(font_table.find(fonthash)!=font_table.end()) + font_face = font_table[fonthash]; FcPattern *fc_pattern = NULL; @@ -1660,7 +1675,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma if(font_face == NULL) { font_face = cairo_win32_font_face_create_for_logfontw(&lfw); - g_hash_table_insert(font_table, fonthash, font_face); + font_table[fonthash] = font_face; } # endif #else @@ -1669,7 +1684,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma fc_pattern = fc_font->font_pattern; if(font_face == NULL) { font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); - g_hash_table_insert(font_table, fonthash, font_face); + font_table[fonthash] = font_face; } # endif #endif @@ -1677,8 +1692,8 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma cairo_save(_cr); cairo_set_font_face(_cr, font_face); - if (fc_pattern && FcPatternGetDouble(fc_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch) - size = 12.0; + //if (fc_pattern && FcPatternGetDouble(fc_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch) + // size = 12.0; // set the given font matrix cairo_matrix_t matrix; @@ -1698,30 +1713,72 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma _showGlyphs(_cr, font, glyphtext, TRUE); } } else { - bool fill = false, stroke = false, have_path = false; + + bool fill = false; if (style->fill.isColor() || style->fill.isPaintserver()) { fill = true; } + bool stroke = false; if (style->stroke.isColor() || style->stroke.isPaintserver()) { stroke = true; } - if (fill) { + + // Text never has markers + bool stroke_over_fill = true; + if ( (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_FILL) || + + (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_FILL) || + + (style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_FILL) ) { + stroke_over_fill = false; + } + + bool have_path = false; + if (fill && stroke_over_fill) { _setFillStyle(style, Geom::OptRect()); if (_is_texttopath) { _showGlyphs(_cr, font, glyphtext, true); - have_path = true; - if (stroke) cairo_fill_preserve(_cr); - else cairo_fill(_cr); + if (stroke) { + cairo_fill_preserve(_cr); + have_path = true; + } else { + cairo_fill(_cr); + } } else { _showGlyphs(_cr, font, glyphtext, false); } } + if (stroke) { _setStrokeStyle(style, Geom::OptRect()); - if (!have_path) _showGlyphs(_cr, font, glyphtext, true); - cairo_stroke(_cr); + if (!have_path) { + _showGlyphs(_cr, font, glyphtext, true); + } + if (fill && _is_texttopath && !stroke_over_fill) { + cairo_stroke_preserve(_cr); + have_path = true; + } else { + cairo_stroke(_cr); + } + } + + if (fill && !stroke_over_fill) { + _setFillStyle(style, Geom::OptRect()); + if (_is_texttopath) { + if (!have_path) { + // Could happen if both 'stroke' and 'stroke_over_fill' are false + _showGlyphs(_cr, font, glyphtext, true); + } + cairo_fill(_cr); + } else { + _showGlyphs(_cr, font, glyphtext, false); + } } + } cairo_restore(_cr); diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 57d155b60..dfa6084d1 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -148,7 +148,14 @@ public: void addClippingRect(double x, double y, double width, double height); /* Rendering methods */ - bool renderPathVector(Geom::PathVector const &pathv, SPStyle const *style, Geom::OptRect const &pbox); + enum CairoPaintOrder { + STROKE_OVER_FILL, + FILL_OVER_STROKE, + FILL_ONLY, + STROKE_ONLY + }; + + bool renderPathVector(Geom::PathVector const &pathv, SPStyle const *style, Geom::OptRect const &pbox, CairoPaintOrder order = STROKE_OVER_FILL); bool renderImage(Inkscape::Pixbuf *pb, Geom::Affine const &image_transform, SPStyle const *style); bool renderGlyphtext(PangoFont *font, Geom::Affine const &font_matrix, @@ -219,7 +226,7 @@ protected: void _prepareRenderGraphic(void); void _prepareRenderText(void); - GHashTable *font_table; + std::map<gpointer, cairo_font_face_t *> font_table; static void font_data_free(gpointer data); CairoRenderState *_createState(void); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 5a5553e97..5dc20ab06 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -194,7 +194,20 @@ static void sp_shape_render(SPShape *shape, CairoRenderContext *ctx) return; } - ctx->renderPathVector(pathv, style, pbox); + if (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_NORMAL || + (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_FILL && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_STROKE)) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::STROKE_OVER_FILL); + } else if (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_FILL ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::FILL_OVER_STROKE); + } else if (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_MARKER ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::STROKE_ONLY); + } else if (style->paint_order.layer[0] == SP_CSS_PAINT_ORDER_FILL && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_MARKER ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::FILL_ONLY); + } // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START @@ -287,6 +300,21 @@ static void sp_shape_render(SPShape *shape, CairoRenderContext *ctx) sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx); } } + + if (style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_FILL && + style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_STROKE) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::STROKE_OVER_FILL); + } else if (style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_FILL ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::FILL_OVER_STROKE); + } else if (style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_STROKE && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_MARKER ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::STROKE_ONLY); + } else if (style->paint_order.layer[2] == SP_CSS_PAINT_ORDER_FILL && + style->paint_order.layer[1] == SP_CSS_PAINT_ORDER_MARKER ) { + ctx->renderPathVector(pathv, style, pbox, CairoRenderContext::FILL_ONLY); + } + } static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) @@ -295,7 +323,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); std::vector<SPObject*> l(group->childList(false)); - for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); x++){ + for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); ++x){ SPItem *item = dynamic_cast<SPItem*>(*x); if (item) { renderer->renderItem(ctx, item); diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index e88cf3d42..13520c40b 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -1174,10 +1174,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values))) d->dc[d->level].style.stroke_dasharray.values.clear(); for (unsigned int i=0; i<pEmr->elp.elpNumEntries; i++) { -// Doing it this way typically results in a pattern that is tiny, better to assume the array -// is the same scale as for dot/dash below, that is, no scaling should be applied -// double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] ); - double dash_length = pEmr->elp.elpStyleEntry[i]; + double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] ); d->dc[d->level].style.stroke_dasharray.values.push_back(dash_length); } d->dc[d->level].style.stroke_dasharray.set = 1; @@ -1620,6 +1617,17 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA uint32_t tbkMode = U_TRANSPARENT; // holds proposed change to bkMode, if text is involved saving these to the DC must wait until the text is written U_COLORREF tbkColor = U_RGB(255, 255, 255); // holds proposed change to bkColor + // code for end user debugging + int eDbgRecord=0; + int eDbgComment=0; + int eDbgFinal=0; + char const* eDbgString = getenv( "INKSCAPE_DBG_EMF" ); + if ( eDbgString != NULL ) { + if(strstr(eDbgString,"RECORD")){ eDbgRecord = 1; } + if(strstr(eDbgString,"COMMENT")){ eDbgComment = 1; } + if(strstr(eDbgString,"FINAL")){ eDbgFinal = 1; } + } + /* initialize the tsp for text reassembly */ tsp.string = NULL; tsp.ori = 0.0; /* degrees */ @@ -1662,8 +1670,11 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA lpEMFR = (PU_ENHMETARECORD)(contents + off); -// Uncomment the following to track down toxic records -// std::cout << "record type: " << iType << " name " << U_emr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl; +// At run time define environment variable INKSCAPE_DBG_EMF to include string RECORD. +// Users may employ this to track down toxic records + if(eDbgRecord){ + std::cout << "record type: " << iType << " name " << U_emr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl; + } off += nSize; SVGOStringStream tmp_outsvg; @@ -3478,14 +3489,20 @@ std::cout << "BEFORE DRAW" dbg_str << "<!-- U_EMR_??? -->\n"; break; } //end of switch -// When testing, uncomment the following to place a comment for each processed EMR record in the SVG -// d->outsvg += dbg_str.str().c_str(); +// At run time define environment variable INKSCAPE_DBG_EMF to include string COMMENT. +// Users may employ this to to place a comment for each processed EMR record in the SVG + if(eDbgComment){ + d->outsvg += dbg_str.str().c_str(); + } d->outsvg += tmp_outsvg.str().c_str(); d->path += tmp_path.str().c_str(); } //end of while -// When testing, uncomment the following to show the final SVG derived from the EMF -// std::cout << d->outsvg << std::endl; +// At run time define environment variable INKSCAPE_DBG_EMF to include string FINAL +// Users may employ this to to show the final SVG derived from the EMF + if(eDbgFinal){ + std::cout << d->outsvg << std::endl; + } (void) emr_properties(U_EMR_INVALID); // force the release of the lookup table memory, returned value is irrelevant return(file_status); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 5b8aae655..1c85182ae 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -253,7 +253,7 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "C"); - snprintf(buff, sizeof(buff) - 1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm")); + snprintf(buff, sizeof(buff) - 1, "Drawing=%.1fx%.1fpx, %.1fx%.1fmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm")); setlocale(LC_NUMERIC, oldlocale); g_free(oldlocale); rec = textcomment_set(buff); @@ -708,7 +708,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) n_dash = style->stroke_dasharray.values.size(); dash = new uint32_t[n_dash]; for (i = 0; i < n_dash; i++) { - dash[i] = style->stroke_dasharray.values[i]; + dash[i] = MAX(1, (uint32_t) round(scale * style->stroke_dasharray.values[i] * PX2WORLD)); } } } @@ -792,9 +792,9 @@ void PrintEmf::destroy_pen() } } -/* Return a Path consisting of just the corner points of the single path in a a PathVector. If the +/* Return a Path consisting of just the corner points of the single path in a PathVector. If the PathVector has more than one path, or that one path is open, or any of its segments are curved, then the -returned PathVector is . If the input path is already just straight lines and vertices the output will be the +returned PathVector is an empty path. If the input path is already just straight lines and vertices the output will be the same as the sole path in the input. */ Geom::Path PrintEmf::pathv_to_simple_polygon(Geom::PathVector const &pathv, int *vertices) @@ -808,6 +808,7 @@ Geom::Path PrintEmf::pathv_to_simple_polygon(Geom::PathVector const &pathv, int Geom::PathVector pv = pathv_to_linear_and_cubic_beziers(pathv); Geom::PathVector::const_iterator pit = pv.begin(); Geom::PathVector::const_iterator pit2 = pv.begin(); + int first_seg=1; ++pit2; *vertices = 0; if(pit->end_closed() != pit->end_default())return(bad); // path must be closed @@ -833,9 +834,17 @@ Geom::Path PrintEmf::pathv_to_simple_polygon(Geom::PathVector const &pathv, int output.start( P1 ); output.close( pit->closed() ); } - *vertices += 1; - Geom::LineSegment ls(P1_trail, P1); - output.append(ls); + if(!Geom::are_near(P1, P1_trail, 1e-5)){ // possible for P1 to start on the end point + Geom::LineSegment ls(P1_trail, P1); + output.append(ls); + if(first_seg){ + *vertices += 2; + first_seg=0; + } + else { + *vertices += 1; + } + } P1_trail = P1; P1 = P1_lead; } @@ -850,7 +859,6 @@ Geom::Path PrintEmf::pathv_to_rect(Geom::PathVector const &pathv, bool *is_rect, { Geom::Point P1_trail; Geom::Point P1; - Geom::Point P1_lead; Geom::Point v1,v2; int vertices; Geom::Path pR = pathv_to_simple_polygon(pathv, &vertices); @@ -860,7 +868,7 @@ Geom::Path PrintEmf::pathv_to_rect(Geom::PathVector const &pathv, bool *is_rect, /* Get the ends of the LAST line segment. Find minimum rotation to align rectangle with X,Y axes. (Very degenerate if it is rotated 45 degrees.) */ *angle = 10.0; /* must be > than the actual angle in radians. */ - for(Geom::Path::iterator cit = pR.begin(); cit != pR.end_open(); ++cit){ + for(Geom::Path::iterator cit = pR.begin();; ++cit){ P1_trail = cit->initialPoint(); P1 = cit->finalPoint(); v1 = unit_vector(P1 - P1_trail); @@ -868,21 +876,23 @@ Geom::Path PrintEmf::pathv_to_rect(Geom::PathVector const &pathv, bool *is_rect, double ang = asin(v1[Geom::Y]); // because component is rotation by ang of {1,0| vector if(fabs(ang) < fabs(*angle))*angle = -ang; // y increases down, flips sign on angle } + if(cit == pR.end_open())break; } /* For increased numerical stability, snap the angle to the nearest 1/100th of a degree. */ double convert = 36000.0/ (2.0 * M_PI); *angle = round(*angle * convert)/convert; - for(Geom::Path::iterator cit = pR.begin(); cit != pR.end_open();++cit) { - P1_lead = cit->finalPoint(); + // at this stage v1 holds the last vector in the path, whichever direction it points. + for(Geom::Path::iterator cit = pR.begin(); ;++cit) { + v2 = v1; + P1_trail = cit->initialPoint(); + P1 = cit->finalPoint(); v1 = unit_vector(P1 - P1_trail); - v2 = unit_vector(P1_lead - P1 ); // P1 is center of a turn that is not 90 degrees. Limit comes from cos(89.9) = .001745 if(!Geom::are_near(dot(v1,v2), 0.0, 2e-3))break; - P1_trail = P1; - P1 = P1_lead; vertex_count++; + if(cit == pR.end_open())break; } if(vertex_count == 4){ *is_rect=true; @@ -903,13 +913,11 @@ int PrintEmf::vector_rect_alignment(double angle, Geom::Point vtest){ int stat = 0; Geom::Point v1 = Geom::unit_vector(vtest); // unit vector to test alignment Geom::Point v2 = Geom::Point(1,0) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) + Geom::Point v3 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) if( Geom::are_near(dot(v1,v2), 1.0, 1e-5)){ stat = 1; } else if(Geom::are_near(dot(v1,v2),-1.0, 1e-5)){ stat = 2; } - if(!stat){ - v2 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit vertical side - if( Geom::are_near(dot(v1,v2), 1.0, 1e-5)){ stat = 3; } - else if(Geom::are_near(dot(v1,v2),-1.0, 1e-5)){ stat = 4; } - } + else if(Geom::are_near(dot(v1,v3), 1.0, 1e-5)){ stat = 3; } + else if(Geom::are_near(dot(v1,v3),-1.0, 1e-5)){ stat = 4; } return(stat); } @@ -924,8 +932,9 @@ int PrintEmf::vector_rect_alignment(double angle, Geom::Point vtest){ */ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int corner){ Geom::Point center(0,0); - for(Geom::Path::iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { + for(Geom::Path::iterator cit = pathRect.begin(); ; ++cit) { center += cit->initialPoint()/4.0; + if(cit == pathRect.end_open())break; } int LR; // 1 if Left, 0 if Right @@ -952,11 +961,12 @@ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int Geom::Point v1 = Geom::Point(1,0) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) Geom::Point v2 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit vertical side (sign change because Y increases DOWN) Geom::Point P1; - for(Geom::Path::iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { + for(Geom::Path::iterator cit = pathRect.begin(); ; ++cit) { P1 = cit->initialPoint(); if ( ( LR == (dot(P1 - center,v1) > 0 ? 0 : 1) ) && ( UL == (dot(P1 - center,v2) > 0 ? 1 : 0) ) ) break; + if(cit == pathRect.end_open())break; } return(P1); } @@ -1279,6 +1289,7 @@ unsigned int PrintEmf::fill( outLR = Geom::Point(wRect,doff_range*hRect); gMode = U_GRADIENT_FILL_RECT_V; } + doff_base = doff_range; rcb.left = round(outUL[X]); // use explicit round for better stability rcb.top = round(outUL[Y]); @@ -1955,7 +1966,7 @@ unsigned int PrintEmf::print_pathv(Geom::PathVector const &pathv, const Geom::Af unsigned int PrintEmf::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom::Point const &p, SPStyle const *const style) { - if (!et) { + if (!et || !text) { return 0; } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 65162af22..25e89bbf3 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -11,7 +11,6 @@ #include "selection.h" #include "document-private.h" #include "sp-item.h" -#include "util/glib-list-iterators.h" #include "extension/extension.h" #include "extension/effect.h" #include "extension/system.h" diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index f5fab1fa2..c15e28854 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -86,8 +86,13 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) ir = new ImageResolution(uri); } if (ir && ir->ok()) { - xscale = 960.0 / floor(10.*ir->x() + .5); // round-off to 0.1 dpi - yscale = 960.0 / floor(10.*ir->y() + .5); + xscale = 960.0 / round(10.*ir->x()); // round-off to 0.1 dpi + yscale = 960.0 / round(10.*ir->y()); + // prevent crash on image with too small dpi (bug 1479193) + if (ir->x() <= .05) + xscale = 960.0; + if (ir->y() <= .05) + yscale = 960.0; } else { xscale = 96.0 / defaultxdpi; yscale = 96.0 / defaultxdpi; diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 8fd82b675..8a9c7a72f 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -24,7 +24,6 @@ #include "document.h" #include "selection.h" #include "sp-object.h" -#include "util/glib-list-iterators.h" #include "2geom/geom.h" #include "svg/path-string.h" diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 5933dd526..dec75aeb6 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -229,7 +229,7 @@ LaTeXTextRenderer::writePostamble() void LaTeXTextRenderer::sp_group_render(SPGroup *group) { std::vector<SPObject*> l = (group->childList(false)); - for(std::vector<SPObject*>::const_iterator x = l.begin(); x != l.end(); x++){ + for(std::vector<SPObject*>::const_iterator x = l.begin(); x != l.end(); ++x){ SPItem *item = dynamic_cast<SPItem*>(*x); if (item) { renderItem(item); diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 2fb36be85..47ba5971c 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -285,8 +285,8 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf return; } char temp[32]; // large enough - temp[31] = '\0'; - strncpy(temp, pat_i->getAttribute("id"), 31); // Some names may be longer than [EW]MFhatch#_###### + strncpy(temp, pat_i->getAttribute("id"), sizeof(temp)-1); // Some names may be longer than [EW]MFhatch#_###### + temp[sizeof(temp)-1] = '\0'; hatch_classify(temp, hatchType, hatchColor, bkColor); if (*hatchType != -1) { return; diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 363061734..c1940b16a 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -223,6 +223,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _importViaInternal->set_can_focus(); _importViaInternal->set_relief(Gtk::RELIEF_NORMAL); _importViaInternal->set_mode(true); + _importViaInternal->set_active(true); _labelViaPoppler->set_line_wrap(true); _labelViaInternal->set_line_wrap(true); #endif diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index 836c34c32..5ede59bf3 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -416,22 +416,14 @@ void PdfParser::parse(Object *obj, GBool topLevel) { for (int i = 0; i < obj->arrayGetLength(); ++i) { obj->arrayGet(i, &obj2); if (!obj2.isStream()) { -#ifdef POPPLER_NEW_ERRORAPI error(errInternal, -1, "Weird page contents"); -#else - error(-1, const_cast<char*>("Weird page contents")); -#endif obj2.free(); return; } obj2.free(); } } else if (!obj->isStream()) { -#ifdef POPPLER_NEW_ERRORAPI error(errInternal, -1, "Weird page contents"); -#else - error(-1, const_cast<char*>("Weird page contents")); -#endif return; } parser = new Parser(xref, new Lexer(xref, obj), gFalse); @@ -476,11 +468,7 @@ void PdfParser::go(GBool /*topLevel*/) // too many arguments - something is wrong } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Too many args in content stream"); -#else - error(getPos(), const_cast<char*>("Too many args in content stream")); -#endif if (printCommands) { printf("throwing away arg: "); obj.print(stdout); @@ -497,11 +485,7 @@ void PdfParser::go(GBool /*topLevel*/) // args at end with no command if (numArgs > 0) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Leftover args in content stream"); -#else - error(getPos(), const_cast<char*>("Leftover args in content stream")); -#endif if (printCommands) { printf("%d leftovers:", numArgs); for (int i = 0; i < numArgs; ++i) { @@ -568,11 +552,7 @@ void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { name = cmd->getCmd(); if (!(op = findOp(name))) { if (ignoreUndef == 0) -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Unknown operator '{0:s}'", name); -#else - error(getPos(), const_cast<char*>("Unknown operator '%s'"), name); -#endif return; } @@ -580,42 +560,26 @@ void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { argPtr = args; if (op->numArgs >= 0) { if (numArgs < op->numArgs) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Too few ({0:d}) args to '{1:d}' operator", numArgs, name); -#else - error(getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name); -#endif return; } if (numArgs > op->numArgs) { #if 0 -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", numArgs, name); -#else - error(getPos(), "Too many (%d) args to '%s' operator", numArgs, name); -#endif #endif argPtr += numArgs - op->numArgs; numArgs = op->numArgs; } } else { if (numArgs > -op->numArgs) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", -#else - error(getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"), -#endif numArgs, name); return; } } for (i = 0; i < numArgs; ++i) { if (!checkArg(&argPtr[i], op->tchk[i])) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Arg #{0:d} to '{1:s}' operator is wrong type ({2:s})", -#else - error(getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"), -#endif i, name, argPtr[i].getTypeName()); return; } @@ -784,11 +748,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) return; } if (!obj1.isDict()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type"), args[0].getName(); -#else - error(getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName()); -#endif obj1.free(); return; } @@ -804,11 +764,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) if (state->parseBlendMode(&obj2, &mode)) { state->setBlendMode(mode); } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState"); -#else - error(getPos(), const_cast<char*>("Invalid blend mode in ExtGState")); -#endif } } obj2.free(); @@ -870,11 +826,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) state->setTransfer(funcs); } } else if (!obj2.isNull()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState"); -#else - error(getPos(), const_cast<char*>("Invalid transfer function in ExtGState")); -#endif } obj2.free(); @@ -894,11 +846,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) funcs[0] = Function::parse(&obj3); if (funcs[0]->getInputSize() != 1 || funcs[0]->getOutputSize() != 1) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); -#else - error(getPos(), const_cast<char*>("Invalid transfer function in soft mask in ExtGState")); -#endif delete funcs[0]; funcs[0] = NULL; } @@ -927,10 +875,8 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL); -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - blendingColorSpace = GfxColorSpace::parse(&obj5, NULL); #else - blendingColorSpace = GfxColorSpace::parse(&obj5); + blendingColorSpace = GfxColorSpace::parse(&obj5, NULL); #endif } obj5.free(); @@ -958,27 +904,15 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/) delete funcs[0]; } } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); -#else - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); -#endif } obj4.free(); } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); -#else - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); -#endif } obj3.free(); } else if (!obj2.isNull()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState"); -#else - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState")); -#endif } } obj2.free(); @@ -1006,11 +940,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, // check form type dict->lookup(const_cast<char*>("FormType"), &obj1); if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Unknown form type"); -#else - error(getPos(), const_cast<char*>("Unknown form type")); -#endif } obj1.free(); @@ -1018,11 +948,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, dict->lookup(const_cast<char*>("BBox"), &obj1); if (!obj1.isArray()) { obj1.free(); -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Bad form bounding box"); -#else - error(getPos(), const_cast<char*>("Bad form bounding box")); -#endif return; } for (i = 0; i < 4; ++i) { @@ -1173,18 +1099,12 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) } else { colorSpace = GfxColorSpace::parse(&obj, NULL, NULL); } -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) +#else if (obj.isNull()) { colorSpace = GfxColorSpace::parse(&args[0], NULL); } else { colorSpace = GfxColorSpace::parse(&obj, NULL); } -#else - if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(&args[0]); - } else { - colorSpace = GfxColorSpace::parse(&obj); - } #endif obj.free(); if (colorSpace) { @@ -1194,11 +1114,7 @@ void PdfParser::opSetFillColorSpace(Object args[], int /*numArgs*/) state->setFillColor(&color); builder->updateStyle(state); } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Bad color space (fill)"); -#else - error(getPos(), const_cast<char*>("Bad color space (fill)")); -#endif } } @@ -1222,18 +1138,12 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) } else { colorSpace = GfxColorSpace::parse(&obj, NULL, NULL); } -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) +#else if (obj.isNull()) { colorSpace = GfxColorSpace::parse(&args[0], NULL); } else { colorSpace = GfxColorSpace::parse(&obj, NULL); } -#else - if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(&args[0]); - } else { - colorSpace = GfxColorSpace::parse(&obj); - } #endif obj.free(); if (colorSpace) { @@ -1243,11 +1153,7 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int /*numArgs*/) state->setStrokeColor(&color); builder->updateStyle(state); } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Bad color space (stroke)"); -#else - error(getPos(), const_cast<char*>("Bad color space (stroke)")); -#endif } } @@ -1256,11 +1162,7 @@ void PdfParser::opSetFillColor(Object args[], int numArgs) { int i; if (numArgs != state->getFillColorSpace()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command")); -#endif return; } state->setFillPattern(NULL); @@ -1276,11 +1178,7 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { int i; if (numArgs != state->getStrokeColorSpace()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command")); -#endif return; } state->setStrokePattern(NULL); @@ -1300,11 +1198,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() || numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace()) ->getUnder()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); -#endif return; } for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { @@ -1322,15 +1216,9 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { state->setFillPattern(pattern); builder->updateStyle(state); } -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { - state->setFillPattern(pattern); - builder->updateStyle(state); - } #else if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName()))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { state->setFillPattern(pattern); builder->updateStyle(state); } @@ -1338,11 +1226,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { } else { if (numArgs != state->getFillColorSpace()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); -#endif return; } state->setFillPattern(NULL); @@ -1366,11 +1250,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { ->getUnder() || numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace()) ->getUnder()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); -#endif return; } for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { @@ -1388,15 +1268,9 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { state->setStrokePattern(pattern); builder->updateStyle(state); } -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { - state->setStrokePattern(pattern); - builder->updateStyle(state); - } #else if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName()))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { state->setStrokePattern(pattern); builder->updateStyle(state); } @@ -1404,11 +1278,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { } else { if (numArgs != state->getStrokeColorSpace()->getNComps()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); -#else - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); -#endif return; } state->setStrokePattern(NULL); @@ -1436,11 +1306,7 @@ void PdfParser::opMoveTo(Object args[], int /*numArgs*/) void PdfParser::opLineTo(Object args[], int /*numArgs*/) { if (!state->isCurPt()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No current point in lineto"); -#else - error(getPos(), const_cast<char*>("No current point in lineto")); -#endif return; } state->lineTo(args[0].getNum(), args[1].getNum()); @@ -1450,11 +1316,7 @@ void PdfParser::opLineTo(Object args[], int /*numArgs*/) void PdfParser::opCurveTo(Object args[], int /*numArgs*/) { if (!state->isCurPt()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No current point in curveto"); -#else - error(getPos(), const_cast<char*>("No current point in curveto")); -#endif return; } double x1 = args[0].getNum(); @@ -1470,11 +1332,7 @@ void PdfParser::opCurveTo(Object args[], int /*numArgs*/) void PdfParser::opCurveTo1(Object args[], int /*numArgs*/) { if (!state->isCurPt()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No current point in curveto1"); -#else - error(getPos(), const_cast<char*>("No current point in curveto1")); -#endif return; } double x1 = state->getCurX(); @@ -1490,11 +1348,7 @@ void PdfParser::opCurveTo1(Object args[], int /*numArgs*/) void PdfParser::opCurveTo2(Object args[], int /*numArgs*/) { if (!state->isCurPt()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No current point in curveto2"); -#else - error(getPos(), const_cast<char*>("No current point in curveto2")); -#endif return; } double x1 = args[0].getNum(); @@ -1523,11 +1377,7 @@ void PdfParser::opRectangle(Object args[], int /*numArgs*/) void PdfParser::opClosePath(Object /*args*/[], int /*numArgs*/) { if (!state->isCurPt()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No current point in closepath"); -#else - error(getPos(), const_cast<char*>("No current point in closepath")); -#endif return; } state->closePath(); @@ -1693,11 +1543,7 @@ void PdfParser::doPatternFillFallback(GBool eoFill) { doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gFalse, eoFill); break; default: -#ifdef POPPLER_NEW_ERRORAPI error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill", -#else - error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"), -#endif pattern->getType()); break; } @@ -1716,11 +1562,7 @@ void PdfParser::doPatternStrokeFallback() { doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gTrue, gFalse); break; default: -#ifdef POPPLER_NEW_ERRORAPI error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke", -#else - error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"), -#endif pattern->getType()); break; } @@ -1847,12 +1689,8 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/) if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) { return; } -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - if (!(shading = res->lookupShading(args[0].getName(), NULL))) { - return; - } #else - if (!(shading = res->lookupShading(args[0].getName()))) { + if (!(shading = res->lookupShading(args[0].getName(), NULL))) { return; } #endif @@ -2161,9 +1999,7 @@ void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) { GfxPatch patch01 = blankPatch(); GfxPatch patch10 = blankPatch(); GfxPatch patch11 = blankPatch(); -#ifdef POPPLER_NEW_GFXPATCH GfxColor color = {{0}}; -#endif double xx[4][8]; double yy[4][8]; double xxm; @@ -2183,16 +2019,10 @@ void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) { > patchColorDelta) { break; } -#ifdef POPPLER_NEW_GFXPATCH color.c[i] = GfxColorComp(patch->color[0][0].c[i]); -#endif } if (i == nComps || depth == maxDepths[pdfPatchMeshShading-1]) { -#ifdef POPPLER_NEW_GFXPATCH state->setFillColor(&color); -#else - state->setFillColor(&patch->color[0][0]); -#endif state->moveTo(patch->x[0][0], patch->y[0][0]); state->curveTo(patch->x[0][1], patch->y[0][1], patch->x[0][2], patch->y[0][2], @@ -2473,11 +2303,7 @@ void PdfParser::opTextNextLine(Object /*args*/[], int /*numArgs*/) void PdfParser::opShowText(Object args[], int /*numArgs*/) { if (!state->getFont()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No font in show"); -#else - error(getPos(), const_cast<char*>("No font in show")); -#endif return; } if (fontChanged) { @@ -2494,11 +2320,7 @@ void PdfParser::opMoveShowText(Object args[], int /*numArgs*/) double ty = 0; if (!state->getFont()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No font in move/show"); -#else - error(getPos(), const_cast<char*>("No font in move/show")); -#endif return; } if (fontChanged) { @@ -2519,11 +2341,7 @@ void PdfParser::opMoveSetShowText(Object args[], int /*numArgs*/) double ty = 0; if (!state->getFont()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No font in move/set/show"); -#else - error(getPos(), const_cast<char*>("No font in move/set/show")); -#endif return; } if (fontChanged) { @@ -2547,11 +2365,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) int wMode = 0; if (!state->getFont()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "No font in show/space"); -#else - error(getPos(), const_cast<char*>("No font in show/space")); -#endif return; } if (fontChanged) { @@ -2576,11 +2390,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) } else if (obj.isString()) { doShowText(obj.getString()); } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Element of show/space array must be number or string"); -#else - error(getPos(), const_cast<char*>("Element of show/space array must be number or string")); -#endif } obj.free(); } @@ -2662,11 +2472,7 @@ void PdfParser::doShowText(GooString *s) { if (charProc.isStream()) { //parse(&charProc, gFalse); // TODO: parse into SVG font } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry"); -#else - error(getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry")); -#endif } //out->endType3Char(state); if (resDict) { @@ -2739,11 +2545,7 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) return; } if (!obj1.isStream()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name); -#else - error(getPos(), const_cast<char*>("XObject '%s' is wrong type"), name); -#endif obj1.free(); return; } @@ -2759,17 +2561,9 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) /* out->psXObject(obj1.getStream(), obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/ } else if (obj2.isName()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName()); -#else - error(getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName()); -#endif } else { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type"); -#else - error(getPos(), const_cast<char*>("XObject subtype is missing or wrong type")); -#endif } obj2.free(); obj1.free(); @@ -2923,10 +2717,8 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - colorSpace = GfxColorSpace::parse(&obj1, NULL); #else - colorSpace = GfxColorSpace::parse(&obj1); + colorSpace = GfxColorSpace::parse(&obj1, NULL); #endif } else if (csMode == streamCSDeviceGray) { colorSpace = new GfxDeviceGrayColorSpace(); @@ -3029,10 +2821,8 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL); #else - GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1); + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL); #endif obj1.free(); if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { @@ -3148,11 +2938,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) err2: obj1.free(); err1: -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Bad image parameters"); -#else - error(getPos(), const_cast<char*>("Bad image parameters")); -#endif } void PdfParser::doForm(Object *str) { @@ -3177,11 +2963,7 @@ void PdfParser::doForm(Object *str) { // check form type dict->lookup(const_cast<char*>("FormType"), &obj1); if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Unknown form type"); -#else - error(getPos(), const_cast<char*>("Unknown form type")); -#endif } obj1.free(); @@ -3189,11 +2971,7 @@ void PdfParser::doForm(Object *str) { dict->lookup(const_cast<char*>("BBox"), &bboxObj); if (!bboxObj.isArray()) { bboxObj.free(); -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Bad form bounding box"); -#else - error(getPos(), const_cast<char*>("Bad form bounding box")); -#endif return; } for (i = 0; i < 4; ++i) { @@ -3233,10 +3011,8 @@ void PdfParser::doForm(Object *str) { blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL); #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL); -#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - blendingColorSpace = GfxColorSpace::parse(&obj3, NULL); #else - blendingColorSpace = GfxColorSpace::parse(&obj3); + blendingColorSpace = GfxColorSpace::parse(&obj3, NULL); #endif } obj3.free(); @@ -3394,11 +3170,7 @@ Stream *PdfParser::buildImageStream() { parser->getObj(&obj); while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) { if (!obj.isName()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object"); -#else - error(getPos(), const_cast<char*>("Inline image dictionary key must be a name object")); -#endif obj.free(); } else { key = copyString(obj.getName()); @@ -3413,11 +3185,7 @@ Stream *PdfParser::buildImageStream() { parser->getObj(&obj); } if (obj.isEOF()) { -#ifdef POPPLER_NEW_ERRORAPI error(errSyntaxError, getPos(), "End of file in inline image"); -#else - error(getPos(), const_cast<char*>("End of file in inline image")); -#endif obj.free(); dict.free(); return NULL; @@ -3433,20 +3201,12 @@ Stream *PdfParser::buildImageStream() { void PdfParser::opImageData(Object /*args*/[], int /*numArgs*/) { -#ifdef POPPLER_NEW_ERRORAPI error(errInternal, getPos(), "Internal: got 'ID' operator"); -#else - error(getPos(), const_cast<char*>("Internal: got 'ID' operator")); -#endif } void PdfParser::opEndImage(Object /*args*/[], int /*numArgs*/) { -#ifdef POPPLER_NEW_ERRORAPI error(errInternal, getPos(), "Internal: got 'EI' operator"); -#else - error(getPos(), const_cast<char*>("Internal: got 'EI' operator")); -#endif } //------------------------------------------------------------------------ diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 58e2030d9..a448be639 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -498,6 +498,7 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat // Obtain clipping path's id from the URL gchar clip_path_id[32]; strncpy(clip_path_id, clip_path_url + 5, strlen(clip_path_url) - 6); + clip_path_id[sizeof (clip_path_id) - 1] = '\0'; SPObject *clip_obj = _doc->getObjectById(clip_path_id); if (clip_obj) { clip_obj->deleteObject(); diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index fa983b83d..b23176ed5 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -67,11 +67,11 @@ Optional compiler switches for development: File: text_reassemble.c -Version: 0.0.17 -Date: 21-MAY-2015 +Version: 0.0.18 +Date: 11-MAR-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -223,7 +223,7 @@ char *TR_construct_fontspec(const TCHUNK_SPECS *tsp, const char *fontname){ int newlen = 128 + strlen(fontname); /* too big, but not by much */ char *newfs = NULL; newfs = (char *) malloc(newlen); - sprintf(newfs,"%s:slant=%d:weight=%d:size=%lf:width=%d",fontname,tsp->italics,tsp->weight,tsp->fs,(tsp->co ? 75 : tsp->condensed)); + sprintf(newfs,"%s:slant=%d:weight=%d:size=%f:width=%d",fontname,tsp->italics,tsp->weight,tsp->fs,(tsp->co ? 75 : tsp->condensed)); return(newfs); } @@ -804,7 +804,7 @@ int ftinfo_load_fontname(FT_INFO *fti, const char *fontspec){ int fb; if(FcPatternGetBool( fpat, FC_OUTLINE, 0, &fb)== FcResultMatch){ printf("outline: %d\n",fb);fflush(stdout); } if(FcPatternGetBool( fpat, FC_SCALABLE, 0, &fb)== FcResultMatch){ printf("scalable: %d\n",fb);fflush(stdout); } - if(FcPatternGetDouble( fpat, FC_DPI, 0, &fd)== FcResultMatch){ printf("DPI: %lf\n",fd);fflush(stdout); } + if(FcPatternGetDouble( fpat, FC_DPI, 0, &fd)== FcResultMatch){ printf("DPI: %f\n",fd);fflush(stdout); } if(FcPatternGetInteger( fpat, FC_FONTVERSION, 0, &fb)== FcResultMatch){ printf("fontversion: %d\n",fb);fflush(stdout); } if(FcPatternGetString( fpat, FC_FULLNAME , 0, (FcChar8 **)&fs)== FcResultMatch){ printf("FULLNAME : %s\n",fs);fflush(stdout); } if(FcPatternGetString( fpat, FC_FAMILY , 0, (FcChar8 **)&fs)== FcResultMatch){ printf("FAMILY : %s\n",fs);fflush(stdout); } @@ -831,7 +831,7 @@ void ftinfo_dump(const FT_INFO *fti){ printf("fti used: %d\n",fti->used); for(i=0; i< fti->used; i++){ fsp = &(fti->fonts[i]); - printf("fti font: %6d space: %6d used: %6d spcadv %8lf fsize %8lf \n",i,fsp->space,fsp->used,fsp->spcadv,fsp->fsize); + printf("fti font: %6d space: %6d used: %6d spcadv %8f fsize %8f \n",i,fsp->space,fsp->used,fsp->spcadv,fsp->fsize); printf(" file: %s\n",fsp->file); printf(" fspc: %s\n",fsp->fontspec); for(j=0;j<fsp->used;j++){ @@ -1123,18 +1123,18 @@ void cxinfo_dump(const TR_INFO *tri){ printf("cxi phase1: %d\n",cxi->phase1); printf("cxi lines: %d\n",cxi->lines); printf("cxi paras: %d\n",cxi->paras); - printf("cxi xy: %lf , %lf\n",tri->x,tri->y); + printf("cxi xy: %f , %f\n",tri->x,tri->y); for(i=0;i<cxi->used;i++){ csp = &(cxi->cx[i]); bsp = &(bri->rects[csp->rt_cidx]); printf("cxi cx[%d] type:%d rt_tidx:%d kids_used:%d kids_space:%d\n",i, csp->type, csp->rt_cidx, csp->kids.used, csp->kids.space); - printf("cxi cx[%d] br (LL,UR) (%lf,%lf),(%lf,%lf)\n",i,bsp->xll,bsp->yll,bsp->xur,bsp->yur); + printf("cxi cx[%d] br (LL,UR) (%f,%f),(%f,%f)\n",i,bsp->xll,bsp->yll,bsp->xur,bsp->yur); for(j=0;j<csp->kids.used;j++){ k = csp->kids.members[j]; bsp = &(bri->rects[k]); if(csp->type == TR_TEXT || csp->type == TR_LINE){ - printf("cxi cx[%d] member:%3d tp_idx:%3d ldir:%d rt_tidx:%3d br (LL,UR) (%8.3lf,%8.3lf),(%8.3lf,%8.3lf) xy (%8.3lf,%8.3lf) kern (%8.3lf,%8.3lf) text:<%s> decor:%5.5x\n", + printf("cxi cx[%d] member:%3d tp_idx:%3d ldir:%d rt_tidx:%3d br (LL,UR) (%8.3f,%8.3f),(%8.3f,%8.3f) xy (%8.3f,%8.3f) kern (%8.3f,%8.3f) text:<%s> decor:%5.5x\n", i, j, k, tpi->chunks[k].ldir, tpi->chunks[k].rt_tidx, bsp->xll,bsp->yll,bsp->xur,bsp->yur, tpi->chunks[k].x, tpi->chunks[k].y, @@ -1311,7 +1311,7 @@ int brinfo_merge(BR_INFO *bri, int dst, int src){ bri->rects[dst].xur = TEREMAX(bri->rects[dst].xur, bri->rects[src].xur); bri->rects[dst].yur = TEREMIN(bri->rects[dst].yur, bri->rects[src].yur); /* MIN because Y is positive DOWN */ /* -printf("bri_Merge into rect:%d (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n",dst, +printf("bri_Merge into rect:%d (LL,UR) dst:(%f,%f),(%f,%f) src:(%f,%f),(%f,%f)\n",dst, (bri->rects[dst].xll), (bri->rects[dst].yll), (bri->rects[dst].xur), @@ -1374,7 +1374,7 @@ int brinfo_overlap(const BR_INFO *bri, int dst, int src, RT_PAD *rp_dst, RT_PAD } } /* -printf("Overlap status:%d\nOverlap trects (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n", +printf("Overlap status:%d\nOverlap trects (LL,UR) dst:(%f,%f),(%f,%f) src:(%f,%f),(%f,%f)\n", status, (br_dst->xll - rp_dst->left ), (br_dst->yll - rp_dst->down ), @@ -1384,7 +1384,7 @@ status, (br_src->yll - rp_src->down ), (br_src->xur + rp_src->right), (br_src->yur + rp_src->up )); -printf("Overlap brects (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n", +printf("Overlap brects (LL,UR) dst:(%f,%f),(%f,%f) src:(%f,%f),(%f,%f)\n", (br_dst->xll), (br_dst->yll), (br_dst->xur), @@ -1393,7 +1393,7 @@ printf("Overlap brects (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n (br_src->yll), (br_src->xur), (br_src->yur)); -printf("Overlap rprect (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n", +printf("Overlap rprect (LL,UR) dst:(%f,%f),(%f,%f) src:(%f,%f),(%f,%f)\n", (rp_dst->left), (rp_dst->down), (rp_dst->right), @@ -1481,7 +1481,7 @@ enum tr_classes brinfo_pp_alignment(const BR_INFO *bri, int dst, int src, double newtype = TR_PARA_UJ; } /* -printf("pp_align newtype:%d brects (LL,UR) dst:(%lf,%lf),(%lf,%lf) src:(%lf,%lf),(%lf,%lf)\n", +printf("pp_align newtype:%d brects (LL,UR) dst:(%f,%f),(%f,%f) src:(%f,%f),(%f,%f)\n", newtype, (br_dst->xll), (br_dst->yll), @@ -1779,7 +1779,7 @@ int trinfo_load_textrec(TR_INFO *tri, const TCHUNK_SPECS *tsp, double escapement tpi->chunks[current].y = x * sin(escapement) + y * cos(escapement); /* Careful! face bbox does NOT scale with FT_Set_Char_Size -printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,%d height:%d size:%lf\n", +printf("Face idx:%d bbox: xMax/Min:%ld,%ld yMax/Min:%ld,%ld UpEM:%d asc/des:%d,%d height:%d size:%f\n", idx, fsp->face->bbox.xMax,fsp->face->bbox.xMin, fsp->face->bbox.yMax,fsp->face->bbox.yMin, @@ -1955,7 +1955,7 @@ void TR_layout_2_svg(TR_INFO *tri){ /* put rectangles down for each text string - debugging!!! This will not work properly for any Narrow fonts */ esc = tri->esc; esc *= 2.0 * M_PI / 360.0; /* degrees to radians and change direction of rotation */ - sprintf(stransform,"transform=\"matrix(%lf,%lf,%lf,%lf,%lf,%lf)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc), 1.25*x,1.25*y); + sprintf(stransform,"transform=\"matrix(%f,%f,%f,%f,%f,%f)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc), 1.25*x,1.25*y); for(i=cxi->phase1; i<cxi->used;i++){ /* over all complex members from phase2 == TR_PARA_* complexes */ csp = &(cxi->cx[i]); for(j=0; j<csp->kids.used; j++){ /* over all members of these complexes, which are phase1 complexes */ @@ -1968,11 +1968,11 @@ void TR_layout_2_svg(TR_INFO *tri){ #if DBG_TR_PARA TRPRINT(tri, "<rect\n"); TRPRINT(tri, "style=\"color:#0000FF;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:none;stroke:#000000;stroke-width:0.8;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n"); - sprintf(obuf,"width=\"%lf\"\n", 1.25*(bri->rects[csp->rt_cidx].xur - bri->rects[csp->rt_cidx].xll)); + sprintf(obuf,"width=\"%f\"\n", 1.25*(bri->rects[csp->rt_cidx].xur - bri->rects[csp->rt_cidx].xll)); TRPRINT(tri, obuf); - sprintf(obuf,"height=\"%lf\"\n",1.25*(bri->rects[csp->rt_cidx].yll - bri->rects[csp->rt_cidx].yur)); + sprintf(obuf,"height=\"%f\"\n",1.25*(bri->rects[csp->rt_cidx].yll - bri->rects[csp->rt_cidx].yur)); TRPRINT(tri, obuf); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n",1.25*(bri->rects[csp->rt_cidx].xll),1.25*(bri->rects[csp->rt_cidx].yur)); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n",1.25*(bri->rects[csp->rt_cidx].xll),1.25*(bri->rects[csp->rt_cidx].yur)); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "/>\n"); @@ -1983,23 +1983,23 @@ void TR_layout_2_svg(TR_INFO *tri){ newy = 1.25*(bri->rects[tsp->rt_tidx].yur); TRPRINT(tri, "<rect\n"); TRPRINT(tri, "style=\"color:#000000;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:none;stroke:#00FF00;stroke-width:0.3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n"); - sprintf(obuf,"width=\"%lf\"\n", 1.25*(bri->rects[tsp->rt_tidx].xur - bri->rects[tsp->rt_tidx].xll)); + sprintf(obuf,"width=\"%f\"\n", 1.25*(bri->rects[tsp->rt_tidx].xur - bri->rects[tsp->rt_tidx].xll)); TRPRINT(tri, obuf); - sprintf(obuf,"height=\"%lf\"\n",1.25*(bri->rects[tsp->rt_tidx].yll - bri->rects[tsp->rt_tidx].yur)); + sprintf(obuf,"height=\"%f\"\n",1.25*(bri->rects[tsp->rt_tidx].yll - bri->rects[tsp->rt_tidx].yur)); TRPRINT(tri, obuf); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n",1.25*(bri->rects[tsp->rt_tidx].xll),newy); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n",1.25*(bri->rects[tsp->rt_tidx].xll),newy); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "/>\n"); newy = 1.25*(bri->rects[tsp->rt_tidx].yll - tsp->boff); - sprintf(obuf,"<text x=\"%lf\" y=\"%lf\"\n",newx, newy ); + sprintf(obuf,"<text x=\"%f\" y=\"%f\"\n",newx, newy ); TRPRINT(tri, obuf); sprintf(obuf,"xml:space=\"preserve\"\n"); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "style=\"fill:#FF0000;"); - sprintf(obuf,"font-size:%lfpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ + sprintf(obuf,"font-size:%fpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ TRPRINT(tri, obuf); sprintf(obuf,"font-style:%s;",(tsp->italics ? "italic" : "normal")); TRPRINT(tri, obuf); @@ -2025,7 +2025,7 @@ void TR_layout_2_svg(TR_INFO *tri){ if(tri->usebk){ esc = tri->esc; esc *= 2.0 * M_PI / 360.0; /* degrees to radians and change direction of rotation */ - sprintf(stransform,"transform=\"matrix(%lf,%lf,%lf,%lf,%lf,%lf)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc), 1.25*x,1.25*y); + sprintf(stransform,"transform=\"matrix(%f,%f,%f,%f,%f,%f)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc), 1.25*x,1.25*y); for(i=cxi->phase1; i<cxi->used;i++){ /* over all complex members from phase2 == TR_PARA_* complexes */ TRPRINT(tri, "<g>\n"); /* group backgrounds for each <text> object in the SVG */ @@ -2037,11 +2037,11 @@ void TR_layout_2_svg(TR_INFO *tri){ TRPRINT(tri, "<rect\n"); sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue); TRPRINT(tri, obuf); - sprintf(obuf,"width=\"%lf\"\n", 1.25*(bri->rects[cline_sp->rt_cidx].xur - bri->rects[cline_sp->rt_cidx].xll)); + sprintf(obuf,"width=\"%f\"\n", 1.25*(bri->rects[cline_sp->rt_cidx].xur - bri->rects[cline_sp->rt_cidx].xll)); TRPRINT(tri, obuf); - sprintf(obuf,"height=\"%lf\"\n",1.25*(bri->rects[cline_sp->rt_cidx].yll - bri->rects[cline_sp->rt_cidx].yur)); + sprintf(obuf,"height=\"%f\"\n",1.25*(bri->rects[cline_sp->rt_cidx].yll - bri->rects[cline_sp->rt_cidx].yur)); TRPRINT(tri, obuf); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n",1.25*(bri->rects[cline_sp->rt_cidx].xll),1.25*(bri->rects[cline_sp->rt_cidx].yur)); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n",1.25*(bri->rects[cline_sp->rt_cidx].xll),1.25*(bri->rects[cline_sp->rt_cidx].yur)); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "/>\n"); @@ -2056,11 +2056,11 @@ void TR_layout_2_svg(TR_INFO *tri){ TRPRINT(tri, "<rect\n"); sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue); TRPRINT(tri, obuf); - sprintf(obuf,"width=\"%lf\"\n", 1.25*(bri->rects[csp->rt_cidx].xur - bri->rects[csp->rt_cidx].xll)); + sprintf(obuf,"width=\"%f\"\n", 1.25*(bri->rects[csp->rt_cidx].xur - bri->rects[csp->rt_cidx].xll)); TRPRINT(tri, obuf); - sprintf(obuf,"height=\"%lf\"\n",1.25*(bri->rects[csp->rt_cidx].yll - bri->rects[csp->rt_cidx].yur)); + sprintf(obuf,"height=\"%f\"\n",1.25*(bri->rects[csp->rt_cidx].yll - bri->rects[csp->rt_cidx].yur)); TRPRINT(tri, obuf); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n",1.25*(bri->rects[csp->rt_cidx].xll),1.25*(bri->rects[csp->rt_cidx].yur)); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n",1.25*(bri->rects[csp->rt_cidx].xll),1.25*(bri->rects[csp->rt_cidx].yur)); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "/>\n"); @@ -2072,11 +2072,11 @@ void TR_layout_2_svg(TR_INFO *tri){ TRPRINT(tri, "<rect\n"); sprintf(obuf,"style=\"color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#%2.2X%2.2X%2.2X;;stroke:none;;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero\"\n",tri->bkcolor.Red,tri->bkcolor.Green,tri->bkcolor.Blue); TRPRINT(tri, obuf); - sprintf(obuf,"width=\"%lf\"\n", 1.25*(bri->rects[tsp->rt_tidx].xur - bri->rects[tsp->rt_tidx].xll)); + sprintf(obuf,"width=\"%f\"\n", 1.25*(bri->rects[tsp->rt_tidx].xur - bri->rects[tsp->rt_tidx].xll)); TRPRINT(tri, obuf); - sprintf(obuf,"height=\"%lf\"\n",1.25*(bri->rects[tsp->rt_tidx].yll - bri->rects[tsp->rt_tidx].yur)); + sprintf(obuf,"height=\"%f\"\n",1.25*(bri->rects[tsp->rt_tidx].yll - bri->rects[tsp->rt_tidx].yur)); TRPRINT(tri, obuf); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n",newx,newy); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n",newx,newy); TRPRINT(tri, obuf); TRPRINT(tri, stransform); TRPRINT(tri, "/>\n"); @@ -2135,7 +2135,7 @@ void TR_layout_2_svg(TR_INFO *tri){ TRPRINT(tri, "<text\n"); TRPRINT(tri, "xml:space=\"preserve\"\n"); TRPRINT(tri, "style=\""); - sprintf(obuf,"font-size:%lfpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ + sprintf(obuf,"font-size:%fpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ TRPRINT(tri, obuf); sprintf(obuf,"font-style:%s;",(tsp->italics ? "italic" : "normal")); TRPRINT(tri, obuf); @@ -2146,7 +2146,7 @@ void TR_layout_2_svg(TR_INFO *tri){ TRPRINT(tri, obuf); if(tsp->vadvance){ lineheight = tsp->vadvance *100.0; } else { lineheight = 125.0; } - sprintf(obuf,"line-height:%lf%%;",lineheight); + sprintf(obuf,"line-height:%f%%;",lineheight); TRPRINT(tri, obuf); TRPRINT(tri, "letter-spacing:0px;"); TRPRINT(tri, "word-spacing:0px;"); @@ -2174,14 +2174,14 @@ void TR_layout_2_svg(TR_INFO *tri){ } TRPRINT(tri, obuf); TRPRINT(tri, "\"\n"); /* End of style specification */ - sprintf(obuf,"transform=\"matrix(%lf,%lf,%lf,%lf,%lf,%lf)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc),1.25*x,1.25*y); + sprintf(obuf,"transform=\"matrix(%f,%f,%f,%f,%f,%f)\"\n",cos(esc),-sin(esc),sin(esc),cos(esc),1.25*x,1.25*y); TRPRINT(tri, obuf); tmpx = 1.25*((ldir == LDIR_RL ? bri->rects[kdx].xur : bri->rects[kdx].xll) + recenter); - sprintf(obuf,"x=\"%lf\" y=\"%lf\"\n>",tmpx,1.25*(bri->rects[kdx].yll - tsp->boff)); + sprintf(obuf,"x=\"%f\" y=\"%f\"\n>",tmpx,1.25*(bri->rects[kdx].yll - tsp->boff)); TRPRINT(tri, obuf); } tmpx = 1.25*((ldir == LDIR_RL ? bri->rects[kdx].xur : bri->rects[kdx].xll) + recenter); - sprintf(obuf,"<tspan sodipodi:role=\"line\"\nx=\"%lf\" y=\"%lf\"\n>",tmpx,1.25*(bri->rects[kdx].yll - tsp->boff)); + sprintf(obuf,"<tspan sodipodi:role=\"line\"\nx=\"%f\" y=\"%f\"\n>",tmpx,1.25*(bri->rects[kdx].yll - tsp->boff)); TRPRINT(tri, obuf); } TRPRINT(tri, "<tspan\n"); @@ -2192,11 +2192,11 @@ void TR_layout_2_svg(TR_INFO *tri){ dx = 1.25 * tsp->xkern; dy = 1.25 * tsp->ykern; - sprintf(obuf,"dx=\"%lf\" dy=\"%lf\" ",dx, dy); + sprintf(obuf,"dx=\"%f\" dy=\"%f\" ",dx, dy); TRPRINT(tri, obuf); sprintf(obuf,"style=\"fill:#%2.2X%2.2X%2.2X;",tsp->color.Red,tsp->color.Green,tsp->color.Blue); TRPRINT(tri, obuf); - sprintf(obuf,"font-size:%lfpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ + sprintf(obuf,"font-size:%fpx;",tsp->fs*1.25); /*IMPORTANT, if the FS is given in pt it looks like crap in browsers. As if px != 1.25 pt, maybe 96 dpi not 90?*/ TRPRINT(tri, obuf); sprintf(obuf,"font-style:%s;",(tsp->italics ? "italic" : "normal")); TRPRINT(tri, obuf); diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index d17180d91..b8b0c73de 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -1528,6 +1528,17 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK uint16_t tbkMode = U_TRANSPARENT; // holds proposed change to bkMode, if text is involved saving these to the DC must wait until the text is written U_COLORREF tbkColor = U_RGB(255, 255, 255); // holds proposed change to bkColor + // code for end user debugging + int wDbgRecord=0; + int wDbgComment=0; + int wDbgFinal=0; + char const* wDbgString = getenv( "INKSCAPE_DBG_WMF" ); + if ( wDbgString != NULL ) { + if(strstr(wDbgString,"RECORD")){ wDbgRecord = 1; } + if(strstr(wDbgString,"COMMENT")){ wDbgComment = 1; } + if(strstr(wDbgString,"FINAL")){ wDbgFinal = 1; } + } + /* initialize the tsp for text reassembly */ tsp.string = NULL; tsp.ori = 0.0; /* degrees */ @@ -1692,8 +1703,11 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK file_status = 0; break; } -// Uncomment the following to track down toxic records -// std::cout << "record type: " << (int) iType << " name " << U_wmr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl; +// At run time define environment variable INKSCAPE_DBG_WMF to include string RECORD. +// Users may employ this to track down toxic records + if(wDbgRecord){ + std::cout << "record type: " << iType << " name " << U_wmr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl; + } SVGOStringStream tmp_path; SVGOStringStream tmp_str; @@ -3034,8 +3048,11 @@ std::cout << "BEFORE DRAW" dbg_str << "<!-- U_WMR_??? -->\n"; break; } //end of switch -// When testing, uncomment the following to place a comment for each processed WMR record in the SVG -// d->outsvg += dbg_str.str().c_str(); +// At run time define environment variable INKSCAPE_DBG_WMF to include string COMMENT. +// Users may employ this to to place a comment for each processed WMR record in the SVG + if(wDbgComment){ + d->outsvg += dbg_str.str().c_str(); + } d->path += tmp_path.str().c_str(); if(!nSize){ // There was some problem with the processing of this record, it is not safe to continue file_status = 0; @@ -3043,8 +3060,11 @@ std::cout << "BEFORE DRAW" } } //end of while on OK -// When testing, uncomment the following to show the final SVG derived from the WMF -// std::cout << d->outsvg << std::endl; +// At run time define environment variable INKSCAPE_DBG_WMF to include string FINAL +// Users may employ this to to show the final SVG derived from the WMF + if(wDbgFinal){ + std::cout << d->outsvg << std::endl; + } (void) U_wmr_properties(U_WMR_INVALID); // force the release of the lookup table memory, returned value is irrelevant return(file_status); diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 431053085..3d913bf1e 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -1325,7 +1325,7 @@ unsigned int PrintWmf::print_pathv(Geom::PathVector const &pathv, const Geom::Af unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom::Point const &p, SPStyle const *const style) { - if (!wt) { + if (!wt || !text) { return 0; } @@ -1369,6 +1369,9 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te char *latin1_text = U_Utf16leToLatin1(unicode_text, 0, NULL); free(unicode_text); + // in some cases a UTF string may reduce to NO latin1 characters, which returns NULL + if(!latin1_text){ return 0; } + //PPT gets funky with text within +-1 degree of a multiple of 90, but only for SOME fonts.Snap those to the central value //Some funky ones: Arial, Times New Roman //Some not funky ones: Symbol and Verdana. diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 8c99ee55d..10029893f 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -15,22 +15,19 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #ifdef linux // does the dollar sign need escaping when passed as string parameter? # define ESCAPE_DOLLAR_COMMANDLINE #endif #include <cstring> + +#include "ui/widget/color-notebook.h" #include <xml/node.h> #include <extension/extension.h> #include "document-private.h" #include "sp-object.h" #include <color.h> -#include "ui/widget/color-notebook.h" #include "parameter.h" #include "bool.h" diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 4e525ff73..1d9205502 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -132,7 +132,7 @@ public: if (_pref->get(NULL, NULL) != NULL) { this->set_text(Glib::ustring(_pref->get(NULL, NULL))); } - this->set_max_length(_pref->getMaxLength()); //Set the max lenght - default zero means no maximum + this->set_max_length(_pref->getMaxLength()); //Set the max length - default zero means no maximum this->signal_changed().connect(sigc::mem_fun(this, &ParamStringEntry::changed_text)); }; void changed_text (void); |
