Improve line wrap
It will now try to separate at word separations
This commit is contained in:
@@ -62,21 +62,29 @@ namespace Nz
|
||||
static SimpleTextDrawer Draw(Font* font, const String& str, unsigned int characterSize, TextStyleFlags style, const Color& color, float outlineThickness, const Color& outlineColor);
|
||||
|
||||
private:
|
||||
void AppendNewLine() const;
|
||||
void AppendNewLine(std::size_t glyphIndex, unsigned int glyphPosition) const;
|
||||
void ClearGlyphs() const;
|
||||
void ConnectFontSlots();
|
||||
void DisconnectFontSlots();
|
||||
bool GenerateGlyph(Glyph& glyph, char32_t character, float outlineThickness, bool lineWrap, Nz::Color color, int renderOrder, int* advance) const;
|
||||
void GenerateGlyphs(const String& text) const;
|
||||
void OnFontAtlasLayerChanged(const Font* font, AbstractImage* oldLayer, AbstractImage* newLayer);
|
||||
void OnFontInvalidated(const Font* font);
|
||||
void OnFontRelease(const Font* object);
|
||||
bool ShouldLineWrap(Glyph& glyph, float size, bool checkFirstGlyph = true) const;
|
||||
void UpdateGlyphColor() const;
|
||||
void UpdateGlyphs() const;
|
||||
|
||||
static constexpr std::size_t InvalidGlyph = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
NazaraSlot(Font, OnFontAtlasChanged, m_atlasChangedSlot);
|
||||
NazaraSlot(Font, OnFontAtlasLayerChanged, m_atlasLayerChangedSlot);
|
||||
NazaraSlot(Font, OnFontGlyphCacheCleared, m_glyphCacheClearedSlot);
|
||||
NazaraSlot(Font, OnFontRelease, m_fontReleaseSlot);
|
||||
|
||||
mutable std::size_t m_lastSeparatorGlyph;
|
||||
mutable unsigned int m_lastSeparatorPosition;
|
||||
mutable std::vector<Glyph> m_glyphs;
|
||||
mutable std::vector<Line> m_lines;
|
||||
Color m_color;
|
||||
|
||||
Reference in New Issue
Block a user