static */
| 354 | } |
| 355 | |
| 356 | /* static */ std::unique_ptr<ParagraphLayouter> ICUParagraphLayoutFactory::GetParagraphLayout(UChar *buff, UChar *buff_end, FontMap &font_mapping) |
| 357 | { |
| 358 | size_t length = buff_end - buff; |
| 359 | /* Can't layout an empty string. */ |
| 360 | if (length == 0) return nullptr; |
| 361 | |
| 362 | /* Can't layout our in-built sprite fonts. */ |
| 363 | for (auto const &[position, font] : font_mapping) { |
| 364 | if (font->fc->IsBuiltInFont()) return nullptr; |
| 365 | } |
| 366 | |
| 367 | auto runs = ItemizeBidi(buff, length); |
| 368 | runs = ItemizeScript(buff, length, runs); |
| 369 | runs = ItemizeStyle(runs, font_mapping); |
| 370 | |
| 371 | if (runs.empty()) return nullptr; |
| 372 | |
| 373 | for (auto &run : runs) { |
| 374 | run.Shape(buff, length); |
| 375 | } |
| 376 | |
| 377 | return std::make_unique<ICUParagraphLayout>(std::move(runs), buff, length); |
| 378 | } |
| 379 | |
| 380 | /* static */ std::unique_ptr<icu::BreakIterator> ICUParagraphLayoutFactory::break_iterator; |
| 381 |
nothing calls this directly
no test coverage detected