2025-12-03 22:00:29 +11:00
|
|
|
#pragma once
|
|
|
|
|
#include "EpdFontData.h"
|
|
|
|
|
|
|
|
|
|
class EpdFont {
|
|
|
|
|
void getTextBounds(const char* string, int startX, int startY, int* minX, int* minY, int* maxX, int* maxY) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const EpdFontData* data;
|
2025-12-06 15:50:11 +11:00
|
|
|
explicit EpdFont(const EpdFontData* data) : data(data) {}
|
2025-12-03 22:00:29 +11:00
|
|
|
~EpdFont() = default;
|
|
|
|
|
void getTextDimensions(const char* string, int* w, int* h) const;
|
|
|
|
|
|
|
|
|
|
const EpdGlyph* getGlyph(uint32_t cp) const;
|
2026-02-24 02:31:43 -06:00
|
|
|
|
2026-03-01 10:43:37 -06:00
|
|
|
/// Returns the kerning adjustment (4.4 fixed-point in pixels) between two codepoints.
|
2026-02-24 02:31:43 -06:00
|
|
|
/// Returns 0 if no kerning data exists for the pair.
|
|
|
|
|
int8_t getKerning(uint32_t leftCp, uint32_t rightCp) const;
|
|
|
|
|
|
|
|
|
|
/// Returns the ligature codepoint for a pair, or 0 if no ligature exists.
|
|
|
|
|
uint32_t getLigature(uint32_t leftCp, uint32_t rightCp) const;
|
|
|
|
|
|
|
|
|
|
/// Greedily applies ligature substitutions starting from cp, consuming
|
|
|
|
|
/// as many following codepoints from text as possible. Returns the
|
|
|
|
|
/// (possibly substituted) codepoint; advances text past consumed chars.
|
|
|
|
|
uint32_t applyLigatures(uint32_t cp, const char*& text) const;
|
2025-12-03 22:00:29 +11:00
|
|
|
};
|