| 390 | } |
| 391 | |
| 392 | PathTextLayout::PathTextLayout(m2::PointD const & tileCenter, std::string const & text, float fontSize, |
| 393 | ref_ptr<dp::TextureManager> textureManager, |
| 394 | localisation::LanguageIndex const textLanguageIndex) |
| 395 | : m_tileCenter(tileCenter) |
| 396 | { |
| 397 | /* |
| 398 | * TODO Temporary workaround: If the string contains newlines, replace them with whitespaces. |
| 399 | * On the long run, this should be fixed in the map generator and this workaround removed after |
| 400 | * a few months, when maps with buggy data can be expected to have been phased out. |
| 401 | */ |
| 402 | std::string stext = text; |
| 403 | while (stext.find('\n') != std::string::npos) |
| 404 | stext[stext.find('\n')] = ' '; |
| 405 | ASSERT_EQUAL(std::string::npos, stext.find('\n'), ("Multiline text is not expected", stext)); |
| 406 | |
| 407 | auto const fontScale = static_cast<float>(VisualParams::Instance().GetFontScale()); |
| 408 | m_textSizeRatio = fontSize * fontScale / dp::kBaseFontSizePixels; |
| 409 | |
| 410 | // TODO(AB): StraightTextLayout used a logic to split a longer string into two strings. |
| 411 | m_shapedGlyphs = |
| 412 | textureManager->ShapeSingleTextLine(dp::kBaseFontSizePixels, stext, &m_glyphRegions, textLanguageIndex); |
| 413 | } |
| 414 | |
| 415 | void PathTextLayout::CacheStaticGeometry(dp::TextureManager::ColorRegion const & colorRegion, |
| 416 | dp::TextureManager::ColorRegion const & outlineRegion, |
nothing calls this directly
no test coverage detected