| 323 | } |
| 324 | |
| 325 | IntPoint TextView::getCursorPoint(size_t _position) const |
| 326 | { |
| 327 | setMin(_position, mLength); |
| 328 | |
| 329 | size_t position = 0; |
| 330 | int top = 0; |
| 331 | float left = 0.0f; |
| 332 | for (const auto& line : mLineInfo) |
| 333 | { |
| 334 | left = (float)line.offset; |
| 335 | if (position + line.count >= _position) |
| 336 | { |
| 337 | for (const auto& sym : line.symbols) |
| 338 | { |
| 339 | if (sym.isColour()) |
| 340 | continue; |
| 341 | |
| 342 | if (position == _position) |
| 343 | break; |
| 344 | |
| 345 | position++; |
| 346 | left += sym.getBearingX() + sym.getAdvance(); |
| 347 | } |
| 348 | break; |
| 349 | } |
| 350 | position += line.count + 1; |
| 351 | top += mFontHeight; |
| 352 | } |
| 353 | |
| 354 | return {(int)left, top}; |
| 355 | } |
| 356 | |
| 357 | const IntSize& TextView::getViewSize() const |
| 358 | { |
no test coverage detected