MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / getTextWidth

Method getTextWidth

lib/GfxRenderer/GfxRenderer.cpp:362–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362int 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
382void GfxRenderer::drawCenteredText(const int fontId, const int y, const char* text, const bool black,
383 const EpdFontFamily::Style style, const BidiUtils::BidiBaseDir baseDir) const {

Callers 15

renderMethod · 0.80
drawCenteredTextMethod · 0.80
drawBatteryRightMethod · 0.80
drawButtonHintsMethod · 0.80
drawSideButtonHintsMethod · 0.80
drawListMethod · 0.80
drawHeaderMethod · 0.80
drawSubHeaderMethod · 0.80
drawTabBarMethod · 0.80
drawRecentBookCoverMethod · 0.80
drawButtonMenuMethod · 0.80
drawPopupMethod · 0.80

Calls 3

resolveVisualTextFunction · 0.85
endMethod · 0.80
getTextDimensionsMethod · 0.45

Tested by

no test coverage detected