2025-12-06 00:34:16 +11:00
|
|
|
#pragma once
|
|
|
|
|
#include "EpdFont.h"
|
|
|
|
|
|
|
|
|
|
class EpdFontFamily {
|
|
|
|
|
public:
|
2025-12-31 12:11:36 +10:00
|
|
|
enum Style : uint8_t { REGULAR = 0, BOLD = 1, ITALIC = 2, BOLD_ITALIC = 3 };
|
|
|
|
|
|
2025-12-06 00:34:16 +11:00
|
|
|
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;
|
2025-12-31 12:11:36 +10:00
|
|
|
void getTextDimensions(const char* string, int* w, int* h, Style style = REGULAR) const;
|
|
|
|
|
bool hasPrintableChars(const char* string, 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;
|
2025-12-06 00:34:16 +11:00
|
|
|
|
2025-12-31 12:11:36 +10:00
|
|
|
const EpdFont* getFont(Style style) const;
|
2025-12-06 00:34:16 +11:00
|
|
|
};
|