MCPcopy Create free account
hub / github.com/Snapchat/Valdi / shape

Method shape

snap_drawing/test/src/WordCachingTextShaper_tests.cpp:26–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
60class WordCachingTextShaperTest : public ::testing::Test {

Callers 1

TEST_FFunction · 0.45

Calls 7

unicodeToUtf8Function · 0.85
strongSmallRefFunction · 0.85
setCharacterMethod · 0.80
resolvedSizeMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected