forked from organicmaps/organicmaps
quick fix for Thai street names rendering bug.
This commit is contained in:
parent
1701b8673d
commit
7c6888e4f7
2 changed files with 38 additions and 8 deletions
|
@ -841,6 +841,34 @@ namespace
|
|||
}
|
||||
};
|
||||
|
||||
double calc_length(m2::PointD const * v, size_t s)
|
||||
{
|
||||
double ret = 0.0;
|
||||
for (size_t i = 1; i < s; ++i)
|
||||
ret += v[i-1].Length(v[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double calc_length(vector<m2::PointD> const & v)
|
||||
{
|
||||
return calc_length(&v[0], v.size());
|
||||
}
|
||||
|
||||
struct TestDrawThaiString
|
||||
{
|
||||
void DoDraw(shared_ptr<graphics::Screen> p)
|
||||
{
|
||||
string s("ถนนสุขุมวิท");
|
||||
|
||||
graphics::FontDesc fontDesc(20, graphics::Color(0, 0, 0, 0), true, graphics::Color(255, 255, 255, 255));
|
||||
p->drawText(fontDesc, m2::PointD(40, 150), graphics::EPosAboveRight, s, 0, true);
|
||||
|
||||
m2::PointD pts[2] = {m2::PointD(200, 100), m2::PointD(400, 300)};
|
||||
|
||||
p->drawPathText(fontDesc, pts, ARRAY_SIZE(pts), s, calc_length(pts, ARRAY_SIZE(pts)), 0, graphics::EPosCenter, graphics::maxDepth);
|
||||
}
|
||||
};
|
||||
|
||||
struct TestDrawStringWithColor
|
||||
{
|
||||
void DoDraw(shared_ptr<graphics::Screen> p)
|
||||
|
@ -886,14 +914,6 @@ namespace
|
|||
};
|
||||
|
||||
|
||||
double calc_length(vector<m2::PointD> const & v)
|
||||
{
|
||||
double ret = 0.0;
|
||||
for (size_t i = 1; i < v.size(); ++i)
|
||||
ret += v[i-1].Length(v[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct TestDrawTextOnPathBigSymbols
|
||||
{
|
||||
vector<m2::PointD> m_path;
|
||||
|
@ -1473,6 +1493,7 @@ namespace
|
|||
UNIT_TEST_GL(TestDrawSingleSymbolAndSolidPath);
|
||||
UNIT_TEST_GL(TestDrawMultiLineStringWithPosition);
|
||||
UNIT_TEST_GL(TestDrawString);
|
||||
UNIT_TEST_GL(TestDrawThaiString);
|
||||
UNIT_TEST_GL(TestDrawStringWithColor);
|
||||
UNIT_TEST_GL(TestDrawUnicodeSymbols);
|
||||
UNIT_TEST_GL(TestDrawTextRect);
|
||||
|
|
|
@ -100,6 +100,15 @@ namespace graphics
|
|||
|
||||
int j = startPt.m_i;
|
||||
|
||||
if (advance < 0)
|
||||
{
|
||||
res.m_angle = startPt.m_segAngle;
|
||||
res.m_pp.m_segAngle = startPt.m_segAngle;
|
||||
res.m_pp.m_i = j;
|
||||
res.m_pp.m_pt = pt1.Move(advance, startPt.m_segAngle.sin(), startPt.m_segAngle.cos());
|
||||
return res;
|
||||
}
|
||||
|
||||
while (advance > 0)
|
||||
{
|
||||
if (j + 1 == size())
|
||||
|
|
Loading…
Add table
Reference in a new issue