| 1550 | } |
| 1551 | |
| 1552 | int GfxRenderer::getSpaceWidth(const int fontId, const EpdFontFamily::Style style) const { |
| 1553 | // Advance table fast-path for SD card fonts during layout |
| 1554 | auto sdIt = sdCardFonts_.find(fontId); |
| 1555 | if (sdIt != sdCardFonts_.end() && sdIt->second->hasAdvanceTable()) { |
| 1556 | const uint8_t resolvedStyle = resolveSdCardStyle(*sdIt->second, style); |
| 1557 | return fp4::toPixel(sdIt->second->getAdvance(' ', resolvedStyle)); |
| 1558 | } |
| 1559 | |
| 1560 | const auto fontIt = fontMap.find(fontId); |
| 1561 | if (fontIt == fontMap.end()) { |
| 1562 | LOG_ERR("GFX", "Font %d not found", fontId); |
| 1563 | return 0; |
| 1564 | } |
| 1565 | |
| 1566 | const EpdGlyph* spaceGlyph = fontIt->second.getGlyph(' ', style); |
| 1567 | return spaceGlyph ? fp4::toPixel(spaceGlyph->advanceX) : 0; // snap 12.4 fixed-point to nearest pixel |
| 1568 | } |
| 1569 | |
| 1570 | int GfxRenderer::getSpaceAdvance(const int fontId, const uint32_t leftCp, const uint32_t rightCp, |
| 1571 | const EpdFontFamily::Style style) const { |
no test coverage detected