Code

Make curvature work again by fixing a minor omission
[inkscape.git] / src / sp-text.cpp
index 9266297bef3772cb622d0612f58fcbb97e5a7df9..0d3fd791b58f813b10ab94ceb0cedff731276adf 100644 (file)
@@ -74,7 +74,7 @@ static void sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &t
 static NRArenaItem *sp_text_show (SPItem *item, NRArena *arena, unsigned key, unsigned flags);
 static void sp_text_hide (SPItem *item, unsigned key);
 static char *sp_text_description (SPItem *item);
-static void sp_text_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs);
+static void sp_text_snappoints(SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const *snapprefs);
 static Geom::Matrix sp_text_set_transform(SPItem *item, Geom::Matrix const &xform);
 static void sp_text_print (SPItem *item, SPPrintContext *gpc);
 
@@ -407,7 +407,7 @@ sp_text_description(SPItem *item)
     SPStyle *style = SP_OBJECT_STYLE(text);
 
     font_instance *tf = font_factory::Default()->FaceFromStyle(style);
-    
+
     char name_buf[256];
     char *n;
     if (tf) {
@@ -428,12 +428,13 @@ sp_text_description(SPItem *item)
     return ret;
 }
 
-static void sp_text_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs)
+static void sp_text_snappoints(SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const */*snapprefs*/)
 {
     // the baseline anchor of the first char
     Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
     if(layout != NULL) {
-        *p = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
+        int type = target ? int(Inkscape::SNAPTARGET_TEXT_BASELINE) : int(Inkscape::SNAPSOURCE_TEXT_BASELINE);
+       p.push_back(std::make_pair(layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item), type));
     }
 }
 
@@ -603,8 +604,8 @@ void SPText::_adjustFontsizeRecursive(SPItem *item, double ex, bool is_root)
     if (style && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) {
         if (!style->font_size.set && is_root) {
             style->font_size.set = 1;
-            style->font_size.type = SP_FONT_SIZE_LENGTH;
         }
+        style->font_size.type = SP_FONT_SIZE_LENGTH;
         style->font_size.computed *= ex;
         style->letter_spacing.computed *= ex;
         style->word_spacing.computed *= ex;
@@ -936,11 +937,11 @@ void TextTagAttributes::addToRotate(unsigned index, double delta)
     SVGLength zero_length;
     zero_length = 0.0;
 
-    if (attributes.rotate.size() < index + 1) {
+    if (attributes.rotate.size() < index + 2) {
         if (attributes.rotate.empty())
-            attributes.rotate.resize(index + 1, zero_length);
+            attributes.rotate.resize(index + 2, zero_length);
         else
-            attributes.rotate.resize(index + 1, attributes.rotate.back());
+            attributes.rotate.resize(index + 2, attributes.rotate.back());
     }
     attributes.rotate[index] = mod360(attributes.rotate[index].computed + delta);
 }