MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetParagraphLayout

Method GetParagraphLayout

src/gfx_layout_icu.cpp:356–378  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

ItemizeBidiFunction · 0.85
ItemizeScriptFunction · 0.85
ItemizeStyleFunction · 0.85
ShapeMethod · 0.80
IsBuiltInFontMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected