| 17 | } |
| 18 | |
| 19 | static std::vector<ShapedGlyph> generateGlyphVec(const Character* characters, size_t length) { |
| 20 | std::vector<ShapedGlyph> out; |
| 21 | out.resize(length); |
| 22 | |
| 23 | auto* data = out.data(); |
| 24 | for (size_t i = 0; i < length; i++) { |
| 25 | auto& glyph = data[i]; |
| 26 | glyph.offsetX = static_cast<Scalar>(i); |
| 27 | glyph.offsetY = -static_cast<Scalar>(i); |
| 28 | glyph.advanceX = static_cast<Scalar>(i) * 2.0f; |
| 29 | glyph.glyphID = static_cast<uint32_t>(i); |
| 30 | |
| 31 | glyph.setCharacter(characters[i], false); |
| 32 | } |
| 33 | |
| 34 | return out; |
| 35 | } |
| 36 | |
| 37 | static TextShaperCacheKey makeCacheKey(FontId fontId, const std::vector<Character>& characters) { |
| 38 | return TextShaperCacheKey(fontId, 0.0f, TextScript::invalid(), false, characters.data(), characters.size()); |
no test coverage detected