2025-12-12 22:13:34 +11:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <EpdFontFamily.h>
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
2025-12-13 20:10:16 +11:00
|
|
|
#include <functional>
|
2025-12-12 22:13:34 +11:00
|
|
|
#include <list>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "blocks/TextBlock.h"
|
|
|
|
|
|
|
|
|
|
class GfxRenderer;
|
|
|
|
|
|
|
|
|
|
class ParsedText {
|
|
|
|
|
std::list<std::string> words;
|
|
|
|
|
std::list<EpdFontStyle> wordStyles;
|
|
|
|
|
TextBlock::BLOCK_STYLE style;
|
2025-12-16 13:02:32 +01:00
|
|
|
bool extraParagraphSpacing;
|
2025-12-12 22:13:34 +11:00
|
|
|
|
|
|
|
|
public:
|
2025-12-16 13:02:32 +01:00
|
|
|
explicit ParsedText(const TextBlock::BLOCK_STYLE style, const bool extraParagraphSpacing)
|
|
|
|
|
: style(style), extraParagraphSpacing(extraParagraphSpacing) {}
|
2025-12-12 22:13:34 +11:00
|
|
|
~ParsedText() = default;
|
|
|
|
|
|
|
|
|
|
void addWord(std::string word, EpdFontStyle fontStyle);
|
|
|
|
|
void setStyle(const TextBlock::BLOCK_STYLE style) { this->style = style; }
|
|
|
|
|
TextBlock::BLOCK_STYLE getStyle() const { return style; }
|
|
|
|
|
bool isEmpty() const { return words.empty(); }
|
2025-12-13 20:10:16 +11:00
|
|
|
void layoutAndExtractLines(const GfxRenderer& renderer, int fontId, int horizontalMargin,
|
|
|
|
|
const std::function<void(std::shared_ptr<TextBlock>)>& processLine);
|
2025-12-12 22:13:34 +11:00
|
|
|
};
|