summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-10-06 22:36:54 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-10-06 22:36:54 +0000
commitafc759a08ad5875467ff657aedcb605e7d555e29 (patch)
treee2c82d68a4da616e09ee59b6cdf5f1ea94d2114f /src
parentFix bspline and strip multi node bspline power editing whith node tool becaus... (diff)
parentinitialisation (diff)
downloadinkscape-afc759a08ad5875467ff657aedcb605e7d555e29.tar.gz
inkscape-afc759a08ad5875467ff657aedcb605e7d555e29.zip
update to trunk
(bzr r11950.1.169)
Diffstat (limited to 'src')
-rw-r--r--src/box3d.cpp9
-rw-r--r--src/box3d.h2
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp35
-rw-r--r--src/libnrtype/Layout-TNG.cpp5
-rw-r--r--src/libnrtype/Layout-TNG.h7
-rw-r--r--src/tools-switch.cpp3
6 files changed, 41 insertions, 20 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 193051ee5..ff99fccba 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -1325,6 +1325,15 @@ SPGroup *box3d_convert_to_group(SPBox3D *box)
return SP_GROUP(doc->getObjectByRepr(grepr));
}
+const char *SPBox3D::displayName() {
+ return _("3D Box");
+}
+
+gchar *SPBox3D::description() {
+ // We could put more details about the 3d box here
+ return g_strdup("");
+}
+
static inline void
box3d_push_back_corner_pair(SPBox3D *box, std::list<std::pair<Geom::Point, Geom::Point> > &pts, int c1, int c2) {
pts.push_back(std::make_pair(box3d_get_corner_screen(box, c1, false),
diff --git a/src/box3d.h b/src/box3d.h
index be5f1926c..1dec1e792 100644
--- a/src/box3d.h
+++ b/src/box3d.h
@@ -61,6 +61,8 @@ public:
virtual const char* display_name();
virtual Geom::Affine set_transform(Geom::Affine const &transform);
virtual void convert_to_guides();
+ virtual const char* displayName();
+ virtual gchar *description();
};
void box3d_position_set (SPBox3D *box);
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index bdc786749..149f600b7 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -221,13 +221,9 @@ void Layout::print(SPPrintContext *ctx,
Geom::Affine const &ctm) const
{
bool text_to_path = ctx->module->textToPath();
-int oldtarget = 0;
-int newtarget = 0;
#define MAX_DX 2048
float hold_dx[MAX_DX]; // For smuggling dx values (character widths) into print functions, unlikely any simple text output will be longer than this.
-float ky; // For smuggling y kern value for span
-int ndx = 0;
-double rtl = 1.0; // 1 L->R, -1 R->L, constant across a span. 1.0 for t->b b->t???
+
Geom::Affine glyph_matrix;
if (_input_stream.empty()) return;
@@ -253,7 +249,10 @@ Geom::Affine glyph_matrix;
double char_x;
int doUTN = CanUTN(); // Unicode to Nonunicode translation enabled if true
Direction block_progression = _blockProgression();
-
+ int oldtarget = 0;
+ int ndx = 0;
+ double rtl = 1.0; // 1 L->R, -1 R->L, constant across a span. 1.0 for t->b b->t???
+
for (unsigned char_index = 0 ; char_index < _characters.size() ; ) {
Glib::ustring text_string; // accumulate text for record in this
Geom::Point g_pos(0,0); // all strings are output at (0,0) because we do the translation using the matrix
@@ -262,7 +261,7 @@ Geom::Affine glyph_matrix;
char_index++;
continue;
}
- ky = _glyphs[glyph_index].y; // same value for all positions in a span
+ float ky = _glyphs[glyph_index].y; // For smuggling y kern value for span // same value for all positions in a span
unsigned span_index = _characters[char_index].in_span;
Span const &span = _spans[span_index];
char_x = 0.0;
@@ -283,12 +282,15 @@ Geom::Affine glyph_matrix;
case Layout::LEFT_TO_RIGHT: rtl = 1.0; break;
case Layout::RIGHT_TO_LEFT: rtl = -1.0; break;
}
- if(doUTN)oldtarget=SingleUnicodeToNon(*text_iter); // this should only ever be with a 1:1 glyph:character situation
+ if(doUTN){
+ oldtarget=SingleUnicodeToNon(*text_iter); // this should only ever be with a 1:1 glyph:character situation
+ }
// accumulate a record to write
unsigned lc_index = char_index;
unsigned hold_iisi = _spans[span_index].in_input_stream_item;
+ int newtarget = 0;
while(1){
glyph_index = _characters[lc_index].in_glyph;
if(glyph_index == -1){ // end of a line within a paragraph, for instance
@@ -377,7 +379,7 @@ std:: cout << "DEBUG Layout::print in while --- "
sp_print_text(ctx, smuggle_string, g_pos, text_source->style);
free(smuggle_string);
sp_print_release(ctx);
- ndx=0;
+ ndx = 0;
char_index = lc_index;
}
}
@@ -546,28 +548,29 @@ Glib::ustring Layout::dumpAsText() const
result += line;
snprintf(line, sizeof(line), "glyphs %zu\n", _glyphs.size());
result += line;
- unsigned lastspan=5000;
+
if(_characters.size() > 1){
+ unsigned lastspan=5000;
for(unsigned j = 0; j < _characters.size() ; j++){
if(lastspan != _characters[j].in_span){
lastspan = _characters[j].in_span;
icc = _spans[lastspan].input_stream_first_character;
}
- snprintf(line, sizeof(line), "char %4d: '%c' 0x%4.4x x=%8.4f glyph=%3d span=%3d\n", j, *icc, *icc, _characters[j].x, _characters[j].in_glyph, _characters[j].in_span);
+ snprintf(line, sizeof(line), "char %4u: '%c' 0x%4.4x x=%8.4f glyph=%3d span=%3d\n", j, *icc, *icc, _characters[j].x, _characters[j].in_glyph, _characters[j].in_span);
result += line;
++icc;
}
}
if(_glyphs.size()){
for(unsigned j = 0; j < _glyphs.size() ; j++){
- snprintf(line, sizeof(line), "glyph %4d: %4d (%8.4f,%8.4f) rot=%8.4f cx=%8.4f char=%4d\n",
+ snprintf(line, sizeof(line), "glyph %4u: %4d (%8.4f,%8.4f) rot=%8.4f cx=%8.4f char=%4d\n",
j, _glyphs[j].glyph, _glyphs[j].x, _glyphs[j].y, _glyphs[j].rotation, _glyphs[j].width, _glyphs[j].in_character);
result += line;
}
}
for (unsigned span_index = 0 ; span_index < _spans.size() ; span_index++) {
- snprintf(line, sizeof(line), "==== span %d \n", span_index);
+ snprintf(line, sizeof(line), "==== span %u \n", span_index);
result += line;
snprintf(line, sizeof(line), " in para %d (direction=%s)\n", _lines[_chunks[_spans[span_index].in_chunk].in_line].in_paragraph,
direction_to_text(_paragraphs[_lines[_chunks[_spans[span_index].in_chunk].in_line].in_paragraph].base_direction));
@@ -600,9 +603,9 @@ Glib::ustring Layout::dumpAsText() const
u.pattr = &_characters[char_index].char_attributes;
if (_characters[char_index].in_span != span_index) continue;
if (_input_stream[_spans[span_index].in_input_stream_item]->Type() != TEXT_SOURCE) {
- snprintf(line, sizeof(line), " %d: control x=%f flags=%03x glyph=%d\n", char_index, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
+ snprintf(line, sizeof(line), " %u: control x=%f flags=%03x glyph=%d\n", char_index, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
} else { // some text has empty tspans, iter_char cannot be dereferenced
- snprintf(line, sizeof(line), " %d: '%c' 0x%4.4x x=%f flags=%03x glyph=%d\n", char_index, *iter_char, *iter_char, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
+ snprintf(line, sizeof(line), " %u: '%c' 0x%4.4x x=%f flags=%03x glyph=%d\n", char_index, *iter_char, *iter_char, _characters[char_index].x, *u.uattr, _characters[char_index].in_glyph);
++iter_char;
}
result += line;
@@ -610,7 +613,7 @@ Glib::ustring Layout::dumpAsText() const
result += " ** glyphs:\n";
for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; glyph_index++) {
if (_characters[_glyphs[glyph_index].in_character].in_span != span_index) continue;
- snprintf(line, sizeof(line), " %d: %d (%f,%f) rot=%f cx=%f char=%d\n", glyph_index, _glyphs[glyph_index].glyph, _glyphs[glyph_index].x, _glyphs[glyph_index].y, _glyphs[glyph_index].rotation, _glyphs[glyph_index].width, _glyphs[glyph_index].in_character);
+ snprintf(line, sizeof(line), " %u: %d (%f,%f) rot=%f cx=%f char=%d\n", glyph_index, _glyphs[glyph_index].glyph, _glyphs[glyph_index].x, _glyphs[glyph_index].y, _glyphs[glyph_index].rotation, _glyphs[glyph_index].width, _glyphs[glyph_index].in_character);
result += line;
}
result += "\n";
diff --git a/src/libnrtype/Layout-TNG.cpp b/src/libnrtype/Layout-TNG.cpp
index bda0d1697..dd9c90949 100644
--- a/src/libnrtype/Layout-TNG.cpp
+++ b/src/libnrtype/Layout-TNG.cpp
@@ -16,9 +16,10 @@ namespace Text {
const gunichar Layout::UNICODE_SOFT_HYPHEN = 0x00AD;
const double Layout::LINE_HEIGHT_NORMAL = 1.25;
-Layout::Layout()
+Layout::Layout() :
+ _input_truncated(0),
+ _path_fitted(NULL)
{
- _path_fitted = NULL;
}
Layout::~Layout()
diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h
index 573301c69..d16c2843d 100644
--- a/src/libnrtype/Layout-TNG.h
+++ b/src/libnrtype/Layout-TNG.h
@@ -817,7 +817,12 @@ class Layout::iterator {
public:
friend class Layout;
// this is just so you can create uninitialised iterators - don't actually try to use one
- iterator() : _parent_layout(NULL) {}
+ iterator() :
+ _parent_layout(NULL),
+ _glyph_index(-1),
+ _char_index(0),
+ _cursor_moving_vertically(false),
+ _x_coordinate(0.0){}
// no copy constructor required, the default does what we want
bool operator== (iterator const &other) const
{return _glyph_index == other._glyph_index && _char_index == other._char_index;}
diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp
index a3c0f2daa..1c07f07cc 100644
--- a/src/tools-switch.cpp
+++ b/src/tools-switch.cpp
@@ -143,7 +143,9 @@ tools_active(SPDesktop *dt)
void
tools_switch(SPDesktop *dt, int num)
{
+ dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, gettext( tool_msg[num] ) );
if (dt) {
+ // This event may change the above message
dt->_tool_changed.emit(num);
}
@@ -152,7 +154,6 @@ tools_switch(SPDesktop *dt, int num)
/* First 4 tools use guides, first is undefined but we don't care */
dt->activate_guides(num < 5);
inkscape_eventcontext_set(dt->getEventContext());
- dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, gettext( tool_msg[num] ) );
}
void tools_switch_by_item(SPDesktop *dt, SPItem *item, Geom::Point const p)