MCPcopy Create free account
hub / github.com/comaps/comaps / ReorderRTL

Function ReorderRTL

libs/drape/harfbuzz_shaping.cpp:189–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void ReorderRTL(TextSegments & segments)
190{
191 // TODO(AB): Optimize implementation to use indexes to segments instead of copying them.
192 auto it = segments.m_segments.begin();
193 auto const end = segments.m_segments.end();
194 // TODO(AB): Line (default rendering) direction is determined by the first segment. It should be defined as
195 // a parameter depending on the language.
196 auto const lineDirection = it->m_direction;
197 while (it != end)
198 {
199 if (it->m_direction == lineDirection)
200 ++it;
201 else
202 {
203 auto const start = it++;
204 while (it != end && it->m_direction != lineDirection)
205 ++it;
206 std::reverse(start, it);
207 }
208 }
209 if (lineDirection != HB_DIRECTION_LTR)
210 std::reverse(segments.m_segments.begin(), end);
211}
212} // namespace
213
214TextSegments GetTextSegments(std::string_view utf8)

Callers 1

GetTextSegmentsFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected