| 63 | } |
| 64 | |
| 65 | void operator()(dp::TextureManager::GlyphRegion const & glyphRegion, dp::text::GlyphMetrics const & metrics) |
| 66 | { |
| 67 | if (!glyphRegion.IsValid()) |
| 68 | return; |
| 69 | m2::PointF const pixelSize = glyphRegion.GetPixelSize() * m_textRatio; |
| 70 | |
| 71 | float const xOffset = metrics.m_xOffset * m_textRatio; |
| 72 | float const yOffset = metrics.m_yOffset * m_textRatio; |
| 73 | |
| 74 | float const upVector = -static_cast<int32_t>(pixelSize.y) - yOffset; |
| 75 | float const bottomVector = -yOffset; |
| 76 | |
| 77 | if (m_isFirstGlyph) |
| 78 | { |
| 79 | m_isFirstGlyph = false; |
| 80 | m_penPosition.x -= (xOffset + dp::kSdfBorder * m_textRatio); |
| 81 | } |
| 82 | |
| 83 | auto const pixelPlusPen = m_pixelOffset + m_penPosition; |
| 84 | m_buffer.emplace_back(m_pivot, pixelPlusPen + glsl::vec2(xOffset, bottomVector)); |
| 85 | m_buffer.emplace_back(m_pivot, pixelPlusPen + glsl::vec2(xOffset, upVector)); |
| 86 | m_buffer.emplace_back(m_pivot, pixelPlusPen + glsl::vec2(pixelSize.x + xOffset, bottomVector)); |
| 87 | m_buffer.emplace_back(m_pivot, pixelPlusPen + glsl::vec2(pixelSize.x + xOffset, upVector)); |
| 88 | // TODO(AB): yAdvance is always zero for horizontal text layouts. |
| 89 | m_penPosition += glsl::vec2(metrics.m_xAdvance * m_textRatio, metrics.m_yAdvance * m_textRatio); |
| 90 | } |
| 91 | |
| 92 | private: |
| 93 | glsl::vec4 const & m_pivot; |
nothing calls this directly
no test coverage detected