diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-11-25 20:51:17 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-11-25 20:51:17 +0000 |
| commit | 0bd9f7e209d522dbcebe0449a91397fdd9e38977 (patch) | |
| tree | 834c7d02456658b57625ab68cc28f7854a5a85dc /src/extension/internal/pdfinput | |
| parent | Fix handling of x and y attributes of patterns (diff) | |
| parent | Fix ruler redraw issue on GTK 2.22 (diff) | |
| download | inkscape-0bd9f7e209d522dbcebe0449a91397fdd9e38977.tar.gz inkscape-0bd9f7e209d522dbcebe0449a91397fdd9e38977.zip | |
Merge from trunk
(bzr r9508.1.70)
Diffstat (limited to 'src/extension/internal/pdfinput')
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 14 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.cpp | 35 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.h | 7 |
3 files changed, 29 insertions, 27 deletions
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index ba00fe343..8dd4698b5 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -36,7 +36,7 @@ #include "pdf-parser.h" #include "document-private.h" -#include "application/application.h" +#include "inkscape.h" #include "dialogs/dialog-events.h" #include <gtk/gtkdialog.h> @@ -390,12 +390,10 @@ void PdfImportDialog::getImportSettings(Inkscape::XML::Node *prefs) { void PdfImportDialog::_onPrecisionChanged() { static Glib::ustring precision_comments[] = { - Glib::ustring(_("rough")), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - Glib::ustring(Q_("pdfinput|medium")), - Glib::ustring(_("fine")), - Glib::ustring(_("very fine")) + Glib::ustring(C_("PDF input precision", "rough")), + Glib::ustring(C_("PDF input precision", "medium")), + Glib::ustring(C_("PDF input precision", "fine")), + Glib::ustring(C_("PDF input precision", "very fine")) }; double min = _fallbackPrecisionSlider_adj->get_lower(); @@ -643,7 +641,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { } PdfImportDialog *dlg = NULL; - if (Inkscape::NSApplication::Application::getUseGui()) { + if (inkscape_use_gui()) { dlg = new PdfImportDialog(pdf_doc, uri); if (!dlg->showDialog()) { delete dlg; diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index b9583545f..e343dbf33 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -1291,8 +1291,8 @@ void SvgBuilder::_flushText() { last_delta_pos = delta_pos; // Append the character to the text buffer - if (0 != glyph.code[0]) { - text_buffer.append((char *)&glyph.code, 1); + if ( !glyph.code.empty() ) { + text_buffer.append(1, glyph.code[0]); } glyphs_in_a_row++; @@ -1333,8 +1333,8 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, return; } // Allow only one space in a row - if ( is_space && _glyphs[_glyphs.size() - 1].code_size == 1 && - _glyphs[_glyphs.size() - 1].code[0] == 32 ) { + if ( is_space && (_glyphs[_glyphs.size() - 1].code.size() == 1) && + (_glyphs[_glyphs.size() - 1].code[0] == 32) ) { Geom::Point delta(dx, dy); _text_position += delta; return; @@ -1350,18 +1350,21 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, _text_position += delta; // Convert the character to UTF-8 since that's our SVG document's encoding - static UnicodeMap *u_map = NULL; - if ( u_map == NULL ) { - GooString *enc = new GooString("UTF-8"); - u_map = globalParams->getUnicodeMap(enc); - u_map->incRefCnt(); - delete enc; - } - int code_size = 0; - for ( int i = 0 ; i < uLen ; i++ ) { - code_size += u_map->mapUnicode(u[i], (char *)&new_glyph.code[code_size], sizeof(new_glyph.code) - code_size); - } - new_glyph.code_size = code_size; + { + gunichar2 uu[8] = {0}; + + for (int i = 0; i < uLen; i++) { + uu[i] = u[i]; + } + + gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL); + if ( tmp && *tmp ) { + new_glyph.code = tmp; + } else { + new_glyph.code.clear(); + } + g_free(tmp); + } // Copy current style if it has changed since the previous glyph if (_invalidated_style || _glyphs.size() == 0 ) { diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index 3b9192d31..f0062bbe6 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -28,6 +28,7 @@ namespace Inkscape { #include <2geom/point.h> #include <2geom/matrix.h> +#include <glibmm/ustring.h> #include "CharTypes.h" class GooString; @@ -75,10 +76,10 @@ struct SvgGraphicsState { struct SvgGlyph { Geom::Point position; // Absolute glyph coords Geom::Point text_position; // Absolute glyph coords in text space - double dx, dy; // Advance values + double dx; // X advance value + double dy; // Y advance value double rise; // Text rise parameter - char code[8]; // UTF-8 coded character - int code_size; + Glib::ustring code; // UTF-8 coded character bool is_space; bool style_changed; // Set to true if style has to be reset |
