rendering text with alignment.

This commit is contained in:
rachytski 2011-04-20 01:39:28 +03:00 committed by Alex Zolotarev
parent 3fdbbd80eb
commit 8df0914287
6 changed files with 118 additions and 58 deletions

View file

@ -225,7 +225,7 @@ bool DrawerYG::filter_text_size(rule_ptr_t pRule) const
return pRule->GetTextHeight() * m_scale <= min_text_height_filtered;
}
void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, int depth)
void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, yg::EPosition pos, int depth)
{
int const color = pRule->GetFillColor();
yg::Color textColor(color == -1 ? yg::Color(0, 0, 0, 0) : yg::Color::fromXRGB(color, pRule->GetAlpha()));
@ -237,6 +237,7 @@ void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t p
if (!filter_text_size(pRule))
m_pScreen->drawText(
pt,
pos,
0.0,
get_text_font_size(pRule),
textColor,
@ -345,7 +346,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size
if (isFill)
drawArea(i->m_path, pRule, depth);
else if (isSym)
drawSymbol(i->GetCenter(), pRule, yg::EPosLeft, depth);
drawSymbol(i->GetCenter() + m2::PointD(0, 2 * m_visualScale), pRule, yg::EPosUnder, depth);
}
}
@ -353,9 +354,9 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size
if (!isPath && !isArea && ((pRule->GetType() & drule::node) != 0))
{
if (isSymbol)
drawSymbol(pInfo->m_point, pRule, yg::EPosLeft, depth);
drawSymbol(pInfo->m_point + m2::PointD(0, 2 * m_visualScale), pRule, yg::EPosUnder, depth);
if (isCircle)
drawCircle(pInfo->m_point, pRule, yg::EPosLeft, depth);
drawCircle(pInfo->m_point + m2::PointD(0, 2 * m_visualScale), pRule, yg::EPosUnder, depth);
}
}
else
@ -368,7 +369,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size
if (isArea && isN)
{
for (list<di::AreaInfo>::const_iterator i = pInfo->m_areas.begin(); i != pInfo->m_areas.end(); ++i)
drawText(i->GetCenter(), pInfo->m_name, pRule, depth);
drawText(i->GetCenter(), pInfo->m_name, pRule, yg::EPosAbove, depth);
}
// draw way name
@ -403,7 +404,7 @@ void DrawerYG::Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size
// draw point text
isN = ((pRule->GetType() & drule::node) != 0);
if (!isPath && !isArea && isN)
drawText(pInfo->m_point, pInfo->m_name, pRule, depth);
drawText(pInfo->m_point, pInfo->m_name, pRule, yg::EPosAbove, depth);
}
}
}

View file

@ -78,7 +78,7 @@ protected:
void drawPath(vector<m2::PointD> const & pts, di::DrawRule const * rules, size_t count);
void drawArea(vector<m2::PointD> const & pts, rule_ptr_t pRule, int depth);
void drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, int depth);
void drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, yg::EPosition pos, int depth);
bool drawPathText(di::PathInfo const & info, string const & name, uint8_t fontSize, int depth);
typedef shared_ptr<yg::gl::BaseTexture> texture_t;

View file

@ -273,8 +273,9 @@ void InformationDisplay::drawRuler(DrawerYG * pDrawer)
pDrawer->screen()->skin()->mapPenInfo(yg::PenInfo(yg::Color(0, 0, 0, 255), 2, 0, 0, 0)),
yg::maxDepth);
m2::RectD textRect = pDrawer->screen()->textRect(scalerText.c_str(), 10, true, false);
m2::RectD textRect = pDrawer->screen()->textRect(scalerText.c_str(), 10, true, true, false);
pDrawer->screen()->drawText(scalerPts[1] + m2::PointD(7, -7),
yg::EPosAboveRight,
0,
10,
yg::Color(0, 0, 0, 0),
@ -324,6 +325,7 @@ void InformationDisplay::drawCenter(DrawerYG * drawer)
out.str().c_str(),
10,
true,
true,
false);
m2::RectD bgRect = m2::Offset(m2::Inflate(textRect, 5.0, 5.0),
@ -338,6 +340,7 @@ void InformationDisplay::drawCenter(DrawerYG * drawer)
drawer->screen()->drawText(
m2::PointD(m_displayRect.maxX() - textRect.SizeX() - 10 * m_visualScale,
m_displayRect.maxY() - (m_bottomShift + 10) * m_visualScale - 5),
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
out.str().c_str(),
@ -365,6 +368,7 @@ void InformationDisplay::drawGlobalRect(DrawerYG *pDrawer)
out << "(" << m_globalRect.minX() << ", " << m_globalRect.minY() << ", " << m_globalRect.maxX() << ", " << m_globalRect.maxY() << ") Scale : " << m_currentScale;
pDrawer->screen()->drawText(
m2::PointD(m_displayRect.minX() + 10, m_displayRect.minY() + m_yOffset),
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
out.str().c_str(),
@ -400,6 +404,7 @@ void InformationDisplay::drawDebugInfo(DrawerYG * drawer)
m2::PointD pos = m2::PointD(m_displayRect.minX() + 10, m_displayRect.minY() + m_yOffset);
drawer->screen()->drawText(pos,
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
out.str().c_str(),
@ -430,6 +435,7 @@ void InformationDisplay::drawMemoryWarning(DrawerYG * drawer)
out << "MemoryWarning : " << m_lastMemoryWarning.ElapsedSeconds() << " sec. ago.";
drawer->screen()->drawText(pos,
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
out.str().c_str(),
@ -504,6 +510,7 @@ void InformationDisplay::drawLog(DrawerYG * pDrawer)
it->c_str(),
10,
true,
true,
false
);
@ -515,6 +522,7 @@ void InformationDisplay::drawLog(DrawerYG * pDrawer)
pDrawer->screen()->drawText(
startPt,
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 255),
it->c_str(),
@ -541,30 +549,34 @@ void InformationDisplay::drawEmptyModelMessage(DrawerYG * pDrawer)
char const s2 [] = "Just click the button at the bottom";
char const s3 [] = "right corner to download the maps.";
m2::RectD tr0 = pDrawer->screen()->textRect(s0, 10, true, false);
m2::RectD tr1 = pDrawer->screen()->textRect(s1, 10, true, false);
m2::RectD tr2 = pDrawer->screen()->textRect(s2, 10, true, false);
m2::RectD tr3 = pDrawer->screen()->textRect(s3, 10, true, false);
m2::RectD tr0 = pDrawer->screen()->textRect(s0, 10, true, true, false);
m2::RectD tr1 = pDrawer->screen()->textRect(s1, 10, true, true, false);
m2::RectD tr2 = pDrawer->screen()->textRect(s2, 10, true, true, false);
m2::RectD tr3 = pDrawer->screen()->textRect(s3, 10, true, true, false);
pDrawer->screen()->drawText(m2::PointD(-tr0.SizeX() / 2, -(tr1.SizeY() + 5)) + pt,
pDrawer->screen()->drawText(m2::PointD(0, -(tr1.SizeY() + 5)) + pt,
yg::EPosCenter,
0, 10, yg::Color(255, 255, 255, 255), s0, true, yg::Color(255, 255, 255, 255),
yg::maxDepth,
true,
false);
pDrawer->screen()->drawText(m2::PointD(-tr1.SizeX() / 2, 0) + pt,
pDrawer->screen()->drawText(m2::PointD(0, 0) + pt,
yg::EPosCenter,
0, 10, yg::Color(255, 255, 255, 255), s1, true, yg::Color(255, 255, 255, 255),
yg::maxDepth,
true,
false);
pDrawer->screen()->drawText(m2::PointD(-tr2.SizeX() / 2, tr2.SizeY() + 5) + pt,
pDrawer->screen()->drawText(m2::PointD(0, tr2.SizeY() + 5) + pt,
yg::EPosCenter,
0, 10, yg::Color(255, 255, 255, 255), s2, true, yg::Color(255, 255, 255, 255),
yg::maxDepth,
true,
false);
pDrawer->screen()->drawText(m2::PointD(-tr3.SizeX() / 2, tr2.SizeY() + 5 + tr3.SizeY() + 5) + pt,
pDrawer->screen()->drawText(m2::PointD(0, tr2.SizeY() + 5 + tr3.SizeY() + 5) + pt,
yg::EPosCenter,
0, 10, yg::Color(255, 255, 255, 255), s3, true, yg::Color(255, 255, 255, 255),
yg::maxDepth,
true,
@ -612,6 +624,7 @@ void InformationDisplay::drawBenchmarkInfo(DrawerYG * pDrawer)
m_yOffset += 20;
m2::PointD pos(m_displayRect.minX() + 10, m_displayRect.minY() + m_yOffset);
pDrawer->screen()->drawText(pos,
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
"benchmark info :",
@ -634,6 +647,7 @@ void InformationDisplay::drawBenchmarkInfo(DrawerYG * pDrawer)
m_yOffset += 20;
pos.y += 20;
pDrawer->screen()->drawText(pos,
yg::EPosAboveRight,
0, 10,
yg::Color(0, 0, 0, 0),
out.str().c_str(),

View file

@ -39,8 +39,8 @@ namespace yg
m_doPeriodicalTextUpdate(params.m_doPeriodicalTextUpdate)
{}
TextRenderer::TextObj::TextObj(m2::PointD const & pt, string const & txt, uint8_t sz, yg::Color const & c, bool isMasked, yg::Color const & maskColor, double d, bool isFixedFont, bool log2vis)
: m_pt(pt), m_size(sz), m_utf8Text(txt), m_isMasked(isMasked), m_depth(d), m_needRedraw(true), m_frozen(false), m_isFixedFont(isFixedFont), m_log2vis(log2vis), m_color(c), m_maskColor(maskColor)
TextRenderer::TextObj::TextObj(m2::PointD const & pt, yg::EPosition pos, string const & txt, uint8_t sz, yg::Color const & c, bool isMasked, yg::Color const & maskColor, double d, bool isFixedFont, bool log2vis)
: m_pt(pt), m_pos(pos), m_size(sz), m_utf8Text(txt), m_isMasked(isMasked), m_depth(d), m_needRedraw(true), m_frozen(false), m_isFixedFont(isFixedFont), m_log2vis(log2vis), m_color(c), m_maskColor(maskColor)
{
}
@ -50,14 +50,34 @@ namespace yg
/// lies inside the testing rect and therefore should be skipped.
if (m_needRedraw)
{
pTextRenderer->drawTextImpl(m_pt, 0.0, m_size, m_color, m_utf8Text, true, m_maskColor, yg::maxDepth, m_isFixedFont, m_log2vis);
pTextRenderer->drawTextImpl(m_pt, m_pos, 0.0, m_size, m_color, m_utf8Text, true, m_maskColor, yg::maxDepth, m_isFixedFont, m_log2vis);
m_frozen = true;
}
}
m2::RectD const TextRenderer::TextObj::GetLimitRect(TextRenderer* pTextRenderer) const
{
return m2::Offset(pTextRenderer->textRect(m_utf8Text, m_size, false, m_log2vis), m_pt);
m2::RectD limitRect = pTextRenderer->textRect(m_utf8Text, m_size, m_isMasked, false, m_log2vis);
double dx = -limitRect.SizeX() / 2;
double dy = limitRect.SizeY() / 2;
if (m_pos & EPosLeft)
dx = -limitRect.SizeX();
if (m_pos & EPosRight)
dx = 0;
if (m_pos & EPosUnder)
dy = limitRect.SizeY();
if (m_pos & EPosAbove)
dy = 0;
dx = ::floor(dx);
dy = ::floor(dy);
return m2::Offset(limitRect, m_pt + m2::PointD(dx, dy));
}
void TextRenderer::TextObj::SetNeedRedraw(bool flag) const
@ -97,25 +117,26 @@ namespace yg
}
void TextRenderer::drawText(m2::PointD const & pt,
float angle,
uint8_t fontSize,
yg::Color const & color,
string const & utf8Text,
bool isMasked,
yg::Color const & maskColor,
double depth,
bool isFixedFont,
bool log2vis)
yg::EPosition pos,
float angle,
uint8_t fontSize,
yg::Color const & color,
string const & utf8Text,
bool isMasked,
yg::Color const & maskColor,
double depth,
bool isFixedFont,
bool log2vis)
{
if (!m_drawTexts)
return;
if (!m_useTextTree || isFixedFont)
drawTextImpl(pt, angle, fontSize, color, utf8Text, true, maskColor, depth, isFixedFont, log2vis);
drawTextImpl(pt, pos, angle, fontSize, color, utf8Text, true, maskColor, depth, isFixedFont, log2vis);
else
{
checkTextRedraw();
TextObj obj(pt, utf8Text, fontSize, color, isMasked, maskColor, depth, isFixedFont, log2vis);
TextObj obj(pt, pos, utf8Text, fontSize, color, isMasked, maskColor, depth, isFixedFont, log2vis);
m2::RectD r = obj.GetLimitRect(this);
m_tree.ReplaceIf(obj, r, &TextObj::better_text);
}
@ -126,10 +147,10 @@ namespace yg
ASSERT(m_useTextTree, ());
if (m_needTextRedraw)
{
m_needTextRedraw = false;
m_tree.ForEach(bind(&TextObj::Draw, _1, this));
/// flushing only texts
base_t::flush(skin()->currentTextPage());
m_needTextRedraw = false;
}
}
@ -229,19 +250,38 @@ namespace yg
return res;
}
void TextRenderer::drawTextImpl(m2::PointD const & pt, float angle, uint8_t fontSize, yg::Color const & color, string const & utf8Text, bool isMasked, yg::Color const & maskColor, double depth, bool isFixedFont, bool log2vis)
void TextRenderer::drawTextImpl(m2::PointD const & pt, yg::EPosition pos, float angle, uint8_t fontSize, yg::Color const & color, string const & utf8Text, bool isMasked, yg::Color const & maskColor, double depth, bool isFixedFont, bool log2vis)
{
wstring text = FromUtf8(utf8Text);
if (log2vis)
text = Log2Vis(text);
m2::RectD r = textRect(utf8Text, fontSize, isMasked, isFixedFont, log2vis);
m2::PointD orgPt(pt.x - r.SizeX() / 2, pt.y + r.SizeY() / 2);
if (pos & EPosLeft)
orgPt.x = pt.x - r.SizeX();
if (pos & EPosRight)
orgPt.x = pt.x;
if (pos & EPosUnder)
orgPt.y = pt.y + r.SizeY();
if (pos & EPosAbove)
orgPt.y = pt.y;
orgPt.x = ::floor(orgPt.x);
orgPt.y = ::floor(orgPt.y);
if (isMasked)
ForEachGlyph(fontSize, maskColor, text, true, isFixedFont, bind(&TextRenderer::drawGlyph, this, cref(pt), _1, angle, 0, _2, depth));
ForEachGlyph(fontSize, color, text, false, isFixedFont, bind(&TextRenderer::drawGlyph, this, cref(pt), _1, angle, 0, _2, depth));
ForEachGlyph(fontSize, maskColor, text, true, isFixedFont, bind(&TextRenderer::drawGlyph, this, cref(orgPt), _1, angle, 0, _2, depth));
ForEachGlyph(fontSize, color, text, false, isFixedFont, bind(&TextRenderer::drawGlyph, this, cref(orgPt), _1, angle, 0, _2, depth));
}
m2::RectD const TextRenderer::textRect(string const & utf8Text, uint8_t fontSize, bool fixedFont, bool log2vis)
m2::RectD const TextRenderer::textRect(string const & utf8Text, uint8_t fontSize, bool isMasked, bool fixedFont, bool log2vis)
{
if (m_useTextTree)
checkTextRedraw();
@ -257,7 +297,7 @@ namespace yg
{
if (fixedFont)
{
uint32_t glyphID = skin()->mapGlyph(GlyphKey(text[i], fontSize, false, yg::Color(0, 0, 0, 0)), fixedFont);
uint32_t glyphID = skin()->mapGlyph(GlyphKey(text[i], fontSize, isMasked, yg::Color(0, 0, 0, 0)), fixedFont);
CharStyle const * p = static_cast<CharStyle const *>(skin()->fromID(glyphID));
if (p != 0)
{
@ -268,7 +308,7 @@ namespace yg
}
else
{
GlyphMetrics const m = resourceManager()->getGlyphMetrics(GlyphKey(text[i], fontSize, false, yg::Color(0, 0, 0, 0)));
GlyphMetrics const m = resourceManager()->getGlyphMetrics(GlyphKey(text[i], fontSize, isMasked, yg::Color(0, 0, 0, 0)));
rect.Add(pt);
rect.Add(pt + m2::PointD(m.m_xOffset + m.m_width, - m.m_yOffset - m.m_height));

View file

@ -22,6 +22,7 @@ namespace yg
class TextObj
{
m2::PointD m_pt;
yg::EPosition m_pos;
uint8_t m_size;
string m_utf8Text;
bool m_isMasked;
@ -35,7 +36,7 @@ namespace yg
public:
TextObj(m2::PointD const & pt, string const & txt, uint8_t sz, yg::Color const & c, bool isMasked, yg::Color const & maskColor, double d, bool isFixedFont, bool log2vis);
TextObj(m2::PointD const & pt, yg::EPosition pos, string const & txt, uint8_t sz, yg::Color const & c, bool isMasked, yg::Color const & maskColor, double d, bool isFixedFont, bool log2vis);
void Draw(TextRenderer * pTextRenderer) const;
m2::RectD const GetLimitRect(TextRenderer * pTextRenderer) const;
void SetNeedRedraw(bool needRedraw) const;
@ -81,6 +82,7 @@ namespace yg
/// Drawing text from point rotated by the angle.
void drawTextImpl(m2::PointD const & pt,
yg::EPosition pos,
float angle,
uint8_t fontSize,
yg::Color const & color,
@ -113,6 +115,7 @@ namespace yg
/// Drawing text from point rotated by the angle.
void drawText(m2::PointD const & pt,
yg::EPosition pos,
float angle,
uint8_t fontSize,
yg::Color const & color,
@ -125,6 +128,7 @@ namespace yg
m2::RectD const textRect(string const & utf8Text,
uint8_t fontSize,
bool isMasked,
bool fixedFont,
bool log2vis);

View file

@ -520,12 +520,12 @@ namespace
double pat[2] = {2, 2};
p->drawPath(path, sizeof(path) / sizeof(m2::PointD), p->skin()->mapPenInfo(yg::PenInfo(yg::Color(0, 0, 0, 0xFF), 2, pat, 2, 0)), 0);
p->drawText(m2::PointD(200, 200), 0 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(240, 200), math::pi / 2 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(280, 200), math::pi , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(320, 200), math::pi * 3 / 2 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(360, 200), math::pi / 18, 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), math::pi / 18, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(200, 200), yg::EPosAboveRight, 0 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(240, 200), yg::EPosAboveRight, math::pi / 2 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(280, 200), yg::EPosAboveRight, math::pi , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(320, 200), yg::EPosAboveRight, math::pi * 3 / 2 , 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(360, 200), yg::EPosAboveRight, math::pi / 18, 20, yg::Color(0, 0, 0, 0), "0", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, math::pi / 18, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
}
};
@ -533,7 +533,7 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0, 20, yg::Color(0, 0, 0, 0), "X", true, yg::Color(255, 255, 255, 255), 1, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0, 20, yg::Color(0, 0, 0, 0), "X", true, yg::Color(255, 255, 255, 255), 1, false, true);
}
};
@ -541,7 +541,7 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0, 20, yg::Color(0, 0, 0, 0), " ", true, yg::Color(255, 255, 255, 255), 1, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0, 20, yg::Color(0, 0, 0, 0), " ", true, yg::Color(255, 255, 255, 255), 1, false, true);
}
};
@ -554,7 +554,7 @@ namespace
for (size_t i = 0; i < maxTimes; ++i)
for (size_t j = 1; j <= i+1; ++j)
p->drawText(m2::PointD(40, 10 + yStep * i), math::pi / 6, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 10 + yStep * i), yg::EPosAboveRight, math::pi / 6, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
}
};
@ -570,7 +570,7 @@ namespace
yg::PenInfo penInfo = yg::PenInfo(yg::Color(0, 0, 0, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
yg::PenInfo solidPenInfo = yg::PenInfo(yg::Color(0xFF, 0, 0, 0xFF), 4, 0, 0, 0);
p->drawText(m2::PointD(40, 50), 0, 20, yg::Color(0, 0, 0, 0), "S", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0, 20, yg::Color(0, 0, 0, 0), "S", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawPath(&path[0], path.size(), p->skin()->mapPenInfo(solidPenInfo), 0);
}
@ -580,7 +580,7 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0/*, math::pi / 18*/, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0/*, math::pi / 18*/, 20, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
}
};
@ -588,7 +588,7 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0/*, math::pi / 18*/, 12, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, true, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0/*, math::pi / 18*/, 12, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, true, true);
}
};
@ -596,7 +596,7 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0/*, math::pi / 18*/, 25, yg::Color(0, 0, 255, 255), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0/*, math::pi / 18*/, 25, yg::Color(0, 0, 255, 255), "Simplicity is the ultimate sophistication", true, yg::Color(255, 255, 255, 255), 0, false, true);
}
};
@ -605,8 +605,8 @@ namespace
{
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
p->drawText(m2::PointD(40, 50), 0, 12, yg::Color(0, 0, 0, 0), "Latin Symbol : A", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 80), 0, 12, yg::Color(0, 0, 0, 0), "Cyrillic Symbol : Ы", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 50), yg::EPosAboveRight, 0, 12, yg::Color(0, 0, 0, 0), "Latin Symbol : A", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(40, 80), yg::EPosAboveRight, 0, 12, yg::Color(0, 0, 0, 0), "Cyrillic Symbol : Ы", true, yg::Color(255, 255, 255, 255), 0, false, true);
}
};
@ -615,7 +615,7 @@ namespace
typedef TestDrawStringWithFixedFont base_t;
void DoDraw(shared_ptr<yg::gl::Screen> p)
{
m2::RectD r = p->textRect("Simplicity is the ultimate sophistication", 12, true, false);
m2::RectD r = p->textRect("Simplicity is the ultimate sophistication", 12, true, true, false);
m2::PointD startPt(40, 50);
@ -690,7 +690,7 @@ namespace
int startY = 30;
for (size_t i = 0; i < sizesCount; ++i)
{
p->drawText(m2::PointD(10, startY), 0, startSize + i, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication. Leonardo Da Vinci", true, yg::Color(255, 255, 255, 255), 0, false, true);
p->drawText(m2::PointD(10, startY), yg::EPosAboveRight, 0, startSize + i, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication. Leonardo Da Vinci", true, yg::Color(255, 255, 255, 255), 0, false, true);
startY += startSize + i;
}
}
@ -706,8 +706,8 @@ namespace
int startY = 30;
for (size_t i = 0; i < sizesCount; ++i)
{
p->drawText(m2::PointD(10, startY), 0, startSize/* + i*/, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication. Leonardo Da Vinci", true, yg::Color(255, 255, 255, 255), 100, false, true);
p->drawText(m2::PointD(5, startY + (startSize + i) / 2), 0, startSize/* + i*/, yg::Color(0, 0, 0, 0), "This text should be filtered", true, yg::Color(255, 255, 255, 255), 100, false, true);
p->drawText(m2::PointD(10, startY), yg::EPosAboveRight, 0, startSize/* + i*/, yg::Color(0, 0, 0, 0), "Simplicity is the ultimate sophistication. Leonardo Da Vinci", true, yg::Color(255, 255, 255, 255), 100, false, true);
p->drawText(m2::PointD(5, startY + (startSize + i) / 2), yg::EPosAboveRight, 0, startSize/* + i*/, yg::Color(0, 0, 0, 0), "This text should be filtered", true, yg::Color(255, 255, 255, 255), 100, false, true);
startY += startSize + i;
}
}
@ -727,6 +727,7 @@ namespace
for (int i = 0; i < textsCount; ++i)
p->drawText(
m2::PointD(rand() % 500, rand() % 500),
yg::EPosAboveRight,
0,
rand() % (endSize - startSize) + startSize,
yg::Color(rand() % 255, rand() % 255, rand() % 255, 255),