| 24 | } |
| 25 | |
| 26 | size_t shape(const Character* unicodeText, |
| 27 | size_t length, |
| 28 | Font& font, |
| 29 | bool isRightToLeft, |
| 30 | Scalar letterSpacing, |
| 31 | TextScript script, |
| 32 | std::vector<ShapedGlyph>& out) override { |
| 33 | TextShaperRequest request; |
| 34 | request.characters = unicodeToUtf8(unicodeText, length); |
| 35 | request.font = Valdi::strongSmallRef(&font); |
| 36 | request.isRightToLeft = isRightToLeft; |
| 37 | request.letterSpacing = letterSpacing; |
| 38 | request.script = script; |
| 39 | |
| 40 | shapeRequests.emplace_back(request); |
| 41 | |
| 42 | auto glyphsStart = out.size(); |
| 43 | out.resize(glyphsStart + length); |
| 44 | auto* outGlyphs = out.data() + glyphsStart; |
| 45 | |
| 46 | for (size_t i = 0; i < length; i++) { |
| 47 | auto& glyph = outGlyphs[i]; |
| 48 | |
| 49 | glyph.setCharacter(unicodeText[i], false); |
| 50 | glyph.glyphID = 0; |
| 51 | glyph.offsetX = 0; |
| 52 | glyph.offsetY = 0; |
| 53 | glyph.advanceX = font.resolvedSize(); |
| 54 | } |
| 55 | |
| 56 | return length; |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | class WordCachingTextShaperTest : public ::testing::Test { |
no test coverage detected