| 212 | } // namespace |
| 213 | |
| 214 | TextSegments GetTextSegments(std::string_view utf8) |
| 215 | { |
| 216 | ASSERT(!utf8.empty(), ("Shaping of empty strings is not supported")); |
| 217 | ASSERT(std::string::npos == utf8.find_first_of("\n"), ("Shaping with line breaks is not supported", utf8)); |
| 218 | |
| 219 | // TODO(AB): Can unnecessary conversion/allocation be avoided? |
| 220 | TextSegments segments{strings::ToUtf16(utf8), {}}; |
| 221 | // TODO(AB): Runs are not split by breaking chars and by different fonts. |
| 222 | GetSingleTextLineRuns(segments); |
| 223 | ReorderRTL(segments); |
| 224 | return segments; |
| 225 | } |
| 226 | |
| 227 | std::string DebugPrint(TextSegment const & segment) |
| 228 | { |