Utility/TextDrawer: Expose lines
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Nz
|
||||
{
|
||||
public:
|
||||
struct Glyph;
|
||||
struct Line;
|
||||
|
||||
AbstractTextDrawer() = default;
|
||||
virtual ~AbstractTextDrawer();
|
||||
@@ -31,15 +32,24 @@ namespace Nz
|
||||
virtual std::size_t GetFontCount() const = 0;
|
||||
virtual const Glyph& GetGlyph(std::size_t index) const = 0;
|
||||
virtual std::size_t GetGlyphCount() const = 0;
|
||||
virtual const Line& GetLine(std::size_t index) const = 0;
|
||||
virtual std::size_t GetLineCount() const = 0;
|
||||
|
||||
struct Glyph
|
||||
{
|
||||
Color color;
|
||||
Rectf bounds;
|
||||
Rectui atlasRect;
|
||||
Vector2f corners[4];
|
||||
AbstractImage* atlas;
|
||||
bool flipped;
|
||||
};
|
||||
|
||||
struct Line
|
||||
{
|
||||
Rectf bounds;
|
||||
std::size_t glyphIndex;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace Nz
|
||||
std::size_t GetFontCount() const override;
|
||||
const Glyph& GetGlyph(std::size_t index) const override;
|
||||
std::size_t GetGlyphCount() const override;
|
||||
const Line& GetLine(std::size_t index) const override;
|
||||
std::size_t GetLineCount() const override;
|
||||
UInt32 GetStyle() const;
|
||||
const String& GetText() const;
|
||||
|
||||
@@ -68,6 +70,7 @@ namespace Nz
|
||||
NazaraSlot(Font, OnFontRelease, m_fontReleaseSlot);
|
||||
|
||||
mutable std::vector<Glyph> m_glyphs;
|
||||
mutable std::vector<Line> m_lines;
|
||||
Color m_color;
|
||||
FontRef m_font;
|
||||
mutable Rectf m_workingBounds;
|
||||
|
||||
Reference in New Issue
Block a user