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

Method GetTextBoundingRect

src/console_gui.cpp:344–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 }
343
344 Rect GetTextBoundingRect(size_t from, size_t to) const override
345 {
346 int delta = std::min<int>(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0);
347
348 const auto p1 = GetCharPosInString(_iconsole_cmdline.GetText(), from, FS_NORMAL);
349 const auto p2 = from != to ? GetCharPosInString(_iconsole_cmdline.GetText(), to, FS_NORMAL) : p1;
350
351 Rect r = {this->line_offset + delta + p1.left, this->height - this->line_height, this->line_offset + delta + p2.right, this->height};
352 return r;
353 }
354
355 ptrdiff_t GetTextCharacterAtPosition(const Point &pt) const override
356 {

Callers

nothing calls this directly

Calls 2

GetCharPosInStringFunction · 0.85
GetTextMethod · 0.45

Tested by

no test coverage detected