| 360 | } |
| 361 | |
| 362 | int GfxRenderer::getTextWidth(const int fontId, const char* text, const EpdFontFamily::Style style, |
| 363 | const BidiUtils::BidiBaseDir baseDir) const { |
| 364 | if (text == nullptr || *text == '\0') { |
| 365 | return 0; |
| 366 | } |
| 367 | |
| 368 | const auto fontIt = fontMap.find(fontId); |
| 369 | if (fontIt == fontMap.end()) { |
| 370 | LOG_ERR("GFX", "Font %d not found", fontId); |
| 371 | return 0; |
| 372 | } |
| 373 | |
| 374 | std::string visual; |
| 375 | const char* renderedText = resolveVisualText(text, visual, baseDir); |
| 376 | |
| 377 | int w = 0, h = 0; |
| 378 | fontIt->second.getTextDimensions(renderedText, &w, &h, style); |
| 379 | return w; |
| 380 | } |
| 381 | |
| 382 | void GfxRenderer::drawCenteredText(const int fontId, const int y, const char* text, const bool black, |
| 383 | const EpdFontFamily::Style style, const BidiUtils::BidiBaseDir baseDir) const { |
no test coverage detected