diff --git a/drape_frontend/path_text_shape.cpp b/drape_frontend/path_text_shape.cpp index 411a456eb6..1ca16e6733 100644 --- a/drape_frontend/path_text_shape.cpp +++ b/drape_frontend/path_text_shape.cpp @@ -190,7 +190,7 @@ void PathTextShape::Draw(RefPointer batcher, RefPointer mutator) const { - float entireLength = m_params.m_OffsetStart * m_scaleFactor; + float entireLength = (m_params.m_OffsetStart) * m_scaleFactor; float const fontSize = m_params.m_TextFont.m_size; int const cnt = m_infos.size(); @@ -198,7 +198,7 @@ void PathTextHandle::GetAttributeMutation(RefPointer mut Spline::iterator itr; itr.Attach(m_path); - itr.Step(m_params.m_OffsetStart * m_scaleFactor); + itr.Step((m_params.m_OffsetStart) * m_scaleFactor); for (int i = 0; i < cnt; i++) { @@ -225,19 +225,23 @@ void PathTextHandle::GetAttributeMutation(RefPointer mut int const index1 = itr.m_index; itr.Step(advance); int const index2 = itr.m_index; - PointF dir; - if (index1 != index2 && index2) + PointF dir(0.0f, 0.0f); + if (index2 > index1) { - PointF const newDir = itr.m_dir; - PointF const newPos = m_path.m_position[index2]; - float const smoothFactor = (newPos - itr.m_pos).Length() / advance; - dir = oldDir * (1.0f - smoothFactor) + newDir * smoothFactor; + float koef = (pos - m_path.m_position[index1+1]).Length() / advance; + dir += m_path.m_direction[index1] * koef; + for (int i = index1 + 1; i < index2; ++i) + { + koef = (m_path.m_position[i] - m_path.m_position[i+1]).Length() / advance; + dir += m_path.m_direction[i] * koef; + } + koef = (itr.m_pos - m_path.m_position[index2]).Length() / advance; + dir += m_path.m_direction[index2] * koef; } else { dir = oldDir; } - float gip = sqrtf(dir.y*dir.y + dir.x*dir.x); ASSERT_NOT_EQUAL(gip, 0.0, ("division by zero")); float const cosa = dir.x / gip; @@ -250,6 +254,7 @@ void PathTextHandle::GetAttributeMutation(RefPointer mut PointF const p3old(-halfWidth + xOffset, halfHeight + yOffset); PointF const p4old(halfWidth + xOffset, halfHeight + yOffset); + math::Matrix m = math::Rotate(math::Identity(), cosa, sina); PointF p1 = (p1old * m_scaleFactor) * m + pos;