mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
* add horizontal indent in first line of paragraph in case Extra Paragraph Spacing is OFF * Treat tabs as whitespace (so they are properly stripped) * Changed size of indent to 1 em. * Fixed calculation of space when indenting (avoiding squeezed text). * Source code formatting
33 lines
975 B
C++
33 lines
975 B
C++
#pragma once
|
|
|
|
#include <EpdFontFamily.h>
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#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;
|
|
bool extraParagraphSpacing;
|
|
|
|
public:
|
|
explicit ParsedText(const TextBlock::BLOCK_STYLE style, const bool extraParagraphSpacing)
|
|
: style(style), extraParagraphSpacing(extraParagraphSpacing) {}
|
|
~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(); }
|
|
void layoutAndExtractLines(const GfxRenderer& renderer, int fontId, int horizontalMargin,
|
|
const std::function<void(std::shared_ptr<TextBlock>)>& processLine);
|
|
};
|