mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Optionally return wraps width when computing breaks WIP.
This commit is contained in:
@@ -15,6 +15,10 @@ struct LineWrapInfo {
|
||||
Float paddingStart{ 0 };
|
||||
};
|
||||
|
||||
struct LineWrapInfoEx : public LineWrapInfo {
|
||||
std::vector<Float> wrapsWidth;
|
||||
};
|
||||
|
||||
class EE_API LineWrap {
|
||||
public:
|
||||
static LineWrapMode toLineWrapMode( std::string mode );
|
||||
@@ -55,12 +59,47 @@ class EE_API LineWrap {
|
||||
Uint32 textHints = TextHints::None,
|
||||
bool tabStops = false, Float initialXOffset = 0.f );
|
||||
|
||||
static LineWrapInfoEx computeLineBreaksEx(
|
||||
const String::View& string, Font* font, Uint32 characterSize, Float maxWidth,
|
||||
LineWrapMode mode, Uint32 fontStyle = 0, Float outlineThickness = 0.f,
|
||||
bool keepIndentation = false, Uint32 tabWidth = 4,
|
||||
Float whiteSpaceWidth = 0.f /* 0 = should calculate it */,
|
||||
Uint32 textHints = TextHints::None, bool tabStops = false, Float initialXOffset = 0.f );
|
||||
|
||||
static LineWrapInfoEx computeLineBreaksEx(
|
||||
const String& string, Font* font, Uint32 characterSize, Float maxWidth, LineWrapMode mode,
|
||||
Uint32 fontStyle = 0, Float outlineThickness = 0.f, bool keepIndentation = false,
|
||||
Uint32 tabWidth = 4, Float whiteSpaceWidth = 0.f /* 0 = should calculate it */,
|
||||
Uint32 textHints = TextHints::None, bool tabStops = false, Float initialXOffset = 0.f );
|
||||
|
||||
static LineWrapInfoEx computeLineBreaksEx(
|
||||
const String::View& string, const FontStyleConfig& fontStyle, Float maxWidth,
|
||||
LineWrapMode mode, bool keepIndentation = false, Uint32 tabWidth = 4,
|
||||
Float whiteSpaceWidth = 0.f /* 0 = should calculate it */,
|
||||
Uint32 textHints = TextHints::None, bool tabStops = false, Float initialXOffset = 0.f );
|
||||
|
||||
static LineWrapInfoEx computeLineBreaksEx( const String& string,
|
||||
const FontStyleConfig& fontStyle, Float maxWidth,
|
||||
LineWrapMode mode, bool keepIndentation = false,
|
||||
Uint32 tabWidth = 4, Float whiteSpaceWidth = 0.f,
|
||||
Uint32 textHints = TextHints::None,
|
||||
bool tabStops = false, Float initialXOffset = 0.f );
|
||||
|
||||
static Float computeOffsets( const String::View& string, Font* font, Uint32 characterSize,
|
||||
Uint32 fontStyle, Float outlineThickness, Uint32 tabWidth = 0.f,
|
||||
Float maxWidth = 0.f, bool tabStops = false );
|
||||
|
||||
static Float computeOffsets( const String::View& string, const FontStyleConfig& fontStyle,
|
||||
Uint32 tabWidth, Float maxWidth = 0.f, bool tabStops = false );
|
||||
|
||||
protected:
|
||||
template <typename T>
|
||||
static T computeLineBreaksInternal( const String::View& string, Font* font,
|
||||
Uint32 characterSize, Float maxWidth, LineWrapMode mode,
|
||||
Uint32 fontStyle, Float outlineThickness,
|
||||
bool keepIndentation, Uint32 tabWidth,
|
||||
Float whiteSpaceWidth, Uint32 textDrawHints, bool tabStops,
|
||||
Float initialXOffset );
|
||||
};
|
||||
|
||||
} // namespace EE::Graphics
|
||||
|
||||
@@ -15,7 +15,7 @@ class Font;
|
||||
|
||||
struct ShapedTextParagraph {
|
||||
std::vector<ShapedGlyph> shapedGlyphs;
|
||||
LineWrapInfo wrapInfo;
|
||||
LineWrapInfoEx wrapInfo;
|
||||
Sizef size;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user