Code

bug 189516: text selection highlight is in the wrong place for text-on-path when...
authorcyreve <cyreve@users.sourceforge.net>
Wed, 6 Feb 2008 20:18:32 +0000 (20:18 +0000)
committercyreve <cyreve@users.sourceforge.net>
Wed, 6 Feb 2008 20:18:32 +0000 (20:18 +0000)
src/libnrtype/Layout-TNG-OutIter.cpp

index 167352bd3d7c2e8d3bd33c49a9dff1b933058138..41fd48c9a0bbb2440702e4a3fccd684856b8fbc7 100755 (executable)
@@ -264,14 +264,15 @@ NR::Rect Layout::characterBoundingBox(iterator const &it, double *rotation) cons
             NR::Point midpoint;
             NR::Point tangent;
             Span const &span = _characters[char_index].span(this);
-            double top = span.baseline_shift - span.line_height.ascent;
-            double bottom = span.baseline_shift + span.line_height.descent;
 
             const_cast<Path*>(_path_fitted)->PointAndTangentAt(midpoint_otp[0].piece, midpoint_otp[0].t, midpoint, tangent);
             top_left[NR::X] = midpoint[NR::X] - cluster_half_width;
-            top_left[NR::Y] = midpoint[NR::Y] + top;
+            top_left[NR::Y] = midpoint[NR::Y] - span.line_height.ascent;
             bottom_right[NR::X] = midpoint[NR::X] + cluster_half_width;
-            bottom_right[NR::Y] = midpoint[NR::Y] + bottom;
+            bottom_right[NR::Y] = midpoint[NR::Y] + span.line_height.descent;
+            NR::Point normal = tangent.cw();
+            top_left += span.baseline_shift * normal;
+            bottom_right += span.baseline_shift * normal;
             if (rotation)
                 *rotation = atan2(tangent[1], tangent[0]);
         }