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:
Sasha Szpakowski
2022-12-26 19:06:08 -04:00
parent 9086afb718
commit 7a0f6621e7
27 changed files with 1490 additions and 626 deletions
+3 -3
View File
@@ -2112,7 +2112,7 @@ int w_newTextBatch(lua_State *L)
luax_catchexcept(L, [&](){ t = instance()->newTextBatch(font); });
else
{
std::vector<Font::ColoredString> text;
std::vector<love::font::ColoredString> text;
luax_checkcoloredstring(L, 2, text);
luax_catchexcept(L, [&](){ t = instance()->newTextBatch(font, text); });
@@ -3132,7 +3132,7 @@ int w_drawShaderVertices(lua_State *L)
int w_print(lua_State *L)
{
std::vector<Font::ColoredString> str;
std::vector<love::font::ColoredString> str;
luax_checkcoloredstring(L, 1, str);
if (luax_istype(L, 2, Font::type))
@@ -3157,7 +3157,7 @@ int w_print(lua_State *L)
int w_printf(lua_State *L)
{
std::vector<Font::ColoredString> str;
std::vector<love::font::ColoredString> str;
luax_checkcoloredstring(L, 1, str);
Font *font = nullptr;