summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 94a7d8c)
raw | patch | inline | side by side (parent: 94a7d8c)
author | Jon A. Cruz <jon@joncruz.org> | |
Sun, 3 Oct 2010 08:54:33 +0000 (01:54 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sun, 3 Oct 2010 08:54:33 +0000 (01:54 -0700) |
src/extension/internal/pdfinput/svg-builder.cpp | patch | blob | history | |
src/extension/internal/pdfinput/svg-builder.h | patch | blob | history |
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index b9583545fb3ed237f0b336769b625aa775e5f11f..e343dbf338a62d404c7c2f6c12679d7acc532dcb 100644 (file)
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++;
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;
_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 3b9192d31a80097e55d6e73a56e00b412c25edd1..f0062bbe68f4382bf164c76abf7d59c63554209a 100644 (file)
#include <2geom/point.h>
#include <2geom/matrix.h>
+#include <glibmm/ustring.h>
#include "CharTypes.h"
class GooString;
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