MCPcopy Create free account
hub / github.com/Tencent/libpag / FindMinMaxPathPosition

Function FindMinMaxPathPosition

src/rendering/renderers/TextPathRender.cpp:155–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155static std::pair<float, float> FindMinMaxPathPosition(
156 const TextPathLayout& pathLayout, const std::vector<std::vector<GlyphHandle>>& glyphLines) {
157 float first = 0;
158 float end = pathLayout.pathLength;
159
160 for (const auto& line : glyphLines) {
161 for (const auto& glyph : line) {
162 auto advance = glyph->getAdvance();
163 auto posX = glyph->getMatrix().getTranslateX();
164 first = std::min(first, MapToPathPosition(posX, pathLayout));
165 end = std::max(end, MapToPathPosition(posX + advance, pathLayout));
166 }
167 }
168 return {first, end};
169}
170
171static float CalculateForceAlignmentLetterSpacing(const TextPathLayout& layout,
172 const std::vector<GlyphHandle>& line) {

Callers 1

applyToGlyphsMethod · 0.85

Calls 3

MapToPathPositionFunction · 0.85
getAdvanceMethod · 0.80
getMatrixMethod · 0.45

Tested by

no test coverage detected