Port 6 upstream PRs (PR #939 was already ported): - #852: Complete HalPowerManager with RAII Lock class, WiFi check in setPowerSaving, skipLoopDelay overrides for ClearCache/OtaUpdate, and power lock in Activity render task loops - #965: Fix paragraph formatting inside list items by tracking listItemUntilDepth to prevent unwanted line breaks - #972: Micro-optimizations: std::move in insertFont, const ref for getDataFromBook parameter - #971: Remove redundant hasPrintableChars pre-rendering pass from EpdFont, EpdFontFamily, and GfxRenderer - #977: Skip unsupported image formats before extraction, add PARSE_BUFFER_SIZE constant and chapter parse timing - #975: Fix UITheme memory leak by replacing raw pointer with std::unique_ptr for currentTheme Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
829 B
C++
24 lines
829 B
C++
#pragma once
|
|
#include "EpdFont.h"
|
|
|
|
class EpdFontFamily {
|
|
public:
|
|
enum Style : uint8_t { REGULAR = 0, BOLD = 1, ITALIC = 2, BOLD_ITALIC = 3, UNDERLINE = 4 };
|
|
|
|
explicit EpdFontFamily(const EpdFont* regular, const EpdFont* bold = nullptr, const EpdFont* italic = nullptr,
|
|
const EpdFont* boldItalic = nullptr)
|
|
: regular(regular), bold(bold), italic(italic), boldItalic(boldItalic) {}
|
|
~EpdFontFamily() = default;
|
|
void getTextDimensions(const char* string, int* w, int* h, Style style = REGULAR) const;
|
|
const EpdFontData* getData(Style style = REGULAR) const;
|
|
const EpdGlyph* getGlyph(uint32_t cp, Style style = REGULAR) const;
|
|
|
|
private:
|
|
const EpdFont* regular;
|
|
const EpdFont* bold;
|
|
const EpdFont* italic;
|
|
const EpdFont* boldItalic;
|
|
|
|
const EpdFont* getFont(Style style) const;
|
|
};
|