mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
Convert Style enum to true bitflags by adding UNDERLINE=4. Update getFont() to use bitwise operations instead of equality checks, allowing styles like BOLD|UNDERLINE to work correctly. This is preparation for encoding underline state directly in the Style rather than tracking it separately.
25 lines
904 B
C++
25 lines
904 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;
|
|
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;
|
|
|
|
const EpdFont* getFont(Style style) const;
|
|
};
|