From 3f73e9b74f1f69002d8f6c00c9e783469f947c17 Mon Sep 17 00:00:00 2001 From: "Kence (casey.peel@gmail.com)" <> Date: Wed, 28 Jan 2015 11:31:29 +0100 Subject: Fix for Bug #437567 (PDF Save As dialog convert text to paths option is confusing). Fixed bugs: - https://launchpad.net/bugs/437567 (bzr r13880) --- src/extension/internal/cairo-ps-out.cpp | 22 ++++++++++++++-------- src/extension/internal/cairo-renderer-pdf-out.cpp | 11 +++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index f6790687c..5dc412301 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -146,12 +146,12 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bool new_textToPath = FALSE; try { - new_textToPath = mod->get_param_bool("textToPath"); + new_textToPath = (strcmp(mod->get_param_optiongroup("textToPath"), "paths") == 0); } catch(...) {} bool new_textToLaTeX = FALSE; try { - new_textToLaTeX = mod->get_param_bool("textToLaTeX"); + new_textToLaTeX = (strcmp(mod->get_param_optiongroup("textToPath"), "LaTeX") == 0); } catch(...) { g_warning("Parameter might not exist"); @@ -235,12 +235,12 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bool new_textToPath = FALSE; try { - new_textToPath = mod->get_param_bool("textToPath"); + new_textToPath = (strcmp(mod->get_param_optiongroup("textToPath"), "paths") == 0); } catch(...) {} bool new_textToLaTeX = FALSE; try { - new_textToLaTeX = mod->get_param_bool("textToLaTeX"); + new_textToLaTeX = (strcmp(mod->get_param_optiongroup("textToPath"), "LaTeX") == 0); } catch(...) { g_warning("Parameter might not exist"); @@ -330,8 +330,11 @@ CairoPsOutput::init (void) "<_item value='PS3'>" N_("PostScript level 3") "\n" "<_item value='PS2'>" N_("PostScript level 2") "\n" "\n" - "false\n" - "false\n" + "\n" + "\n" + "\n" + "\n" + "\n" "true\n" "96\n" "\n" @@ -369,8 +372,11 @@ CairoEpsOutput::init (void) "<_item value='PS3'>" N_("PostScript level 3") "\n" "<_item value='PS2'>" N_("PostScript level 2") "\n" "\n" - "false\n" - "false\n" + "\n" + "\n" + "\n" + "\n" + "\n" "true\n" "96\n" "\n" diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 0c4ad4f0a..e5c9406c9 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -149,7 +149,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, bool new_textToPath = FALSE; try { - new_textToPath = mod->get_param_bool("textToPath"); + new_textToPath = (strcmp(mod->get_param_optiongroup("textToPath"), "paths") == 0); } catch(...) { g_warning("Parameter might not exist"); @@ -157,7 +157,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, bool new_textToLaTeX = FALSE; try { - new_textToLaTeX = mod->get_param_bool("textToLaTeX"); + new_textToLaTeX = (strcmp(mod->get_param_optiongroup("textToPath"), "LaTeX") == 0); } catch(...) { g_warning("Parameter might not exist"); @@ -247,8 +247,11 @@ CairoRendererPdfOutput::init (void) #endif "<_item value='PDF-1.4'>" N_("PDF 1.4") "\n" "\n" - "false\n" - "false\n" + "\n" + "\n" + "\n" + "\n" + "\n" "true\n" "96\n" "\n" -- cgit v1.2.3 From a8ef610e1960c0e0d61f417471e8d2c32b51db9a Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Wed, 28 Jan 2015 19:03:12 -0500 Subject: for snapping to grids and guides, reduce numerical error for the case of uniform scaling of viewbox (bzr r13881) --- src/display/canvas-axonomgrid.cpp | 5 +++++ src/display/canvas-grid.cpp | 5 +++++ src/sp-guide.cpp | 11 +++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 05ba71a49..ac93f5c88 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -220,6 +220,11 @@ CanvasAxonomGrid::readRepr() if( root->viewBox_set ) { scale_x = root->width.computed / root->viewBox.width(); scale_y = root->height.computed / root->viewBox.height(); + if (Geom::are_near(scale_x / scale_y, 1.0, Geom::EPSILON)) { + // scaling is uniform, try to reduce numerical error + scale_x = (scale_x + scale_y)/2.0; + scale_y = scale_x; + } } gchar const *value; diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 1a284b46e..0a43ed8b7 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -544,6 +544,11 @@ CanvasXYGrid::readRepr() if( root->viewBox_set ) { scale_x = root->width.computed / root->viewBox.width(); scale_y = root->height.computed / root->viewBox.height(); + if (Geom::are_near(scale_x / scale_y, 1.0, Geom::EPSILON)) { + // scaling is uniform, try to reduce numerical error + scale_x = (scale_x + scale_y)/2.0; + scale_y = scale_x; + } } gchar const *value; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 890c1f597..08b055508 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -156,8 +156,15 @@ void SPGuide::set(unsigned int key, const gchar *value) { // If root viewBox set, interpret guides in terms of viewBox (90/96) SPRoot *root = document->getRoot(); if( root->viewBox_set ) { - newx = newx * root->width.computed / root->viewBox.width(); - newy = newy * root->height.computed / root->viewBox.height(); + if(Geom::are_near((root->width.computed * root->viewBox.height()) / (root->viewBox.width() * root->height.computed), 1.0, Geom::EPSILON)) { + // for uniform scaling, try to reduce numerical error + double vbunit2px = (root->width.computed / root->viewBox.width() + root->height.computed / root->viewBox.height())/2.0; + newx = newx * vbunit2px; + newy = newy * vbunit2px; + } else { + newx = newx * root->width.computed / root->viewBox.width(); + newy = newy * root->height.computed / root->viewBox.height(); + } } this->point_on_line = Geom::Point(newx, newy); } else if (success == 1) { -- cgit v1.2.3