mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Initial (WIP) Harfbuzz text shaping integration.
This a significant refactor / rewrite of much of the love.graphics Font code. Text positioning is now split into TextShaper classes in the love.font module. This isn't exposed to users yet. BMFonts and ImageFonts use the same text shaping as before (in the new TextShaper API). Fonts loaded via FreeType now use Harfbuzz for text shaping. The new code isn't at feature-parity with the old code yet. Harfbuzz-based text shaping enables kerning support in more fonts, character combining into ligature glyphs, and directions other than left-to-right (this isn't supported in love yet).
This commit is contained in:
@@ -40,14 +40,14 @@ public:
|
||||
|
||||
static love::Type type;
|
||||
|
||||
TextBatch(Font *font, const std::vector<Font::ColoredString> &text = {});
|
||||
TextBatch(Font *font, const std::vector<love::font::ColoredString> &text = {});
|
||||
virtual ~TextBatch();
|
||||
|
||||
void set(const std::vector<Font::ColoredString> &text);
|
||||
void set(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align);
|
||||
void set(const std::vector<love::font::ColoredString> &text);
|
||||
void set(const std::vector<love::font::ColoredString> &text, float wrap, Font::AlignMode align);
|
||||
|
||||
int add(const std::vector<Font::ColoredString> &text, const Matrix4 &m);
|
||||
int addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, const Matrix4 &m);
|
||||
int add(const std::vector<love::font::ColoredString> &text, const Matrix4 &m);
|
||||
int addf(const std::vector<love::font::ColoredString> &text, float wrap, Font::AlignMode align, const Matrix4 &m);
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -71,10 +71,10 @@ private:
|
||||
|
||||
struct TextData
|
||||
{
|
||||
Font::ColoredCodepoints codepoints;
|
||||
love::font::ColoredCodepoints codepoints;
|
||||
float wrap;
|
||||
Font::AlignMode align;
|
||||
Font::TextInfo textInfo;
|
||||
love::font::TextShaper::TextInfo textInfo;
|
||||
bool useMatrix;
|
||||
bool appendVertices;
|
||||
Matrix4 matrix;
|
||||
|
||||
Reference in New Issue
Block a user