mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +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:
@@ -36,7 +36,7 @@ int w_TextBatch_set(lua_State *L)
|
||||
{
|
||||
TextBatch *t = luax_checktextbatch(L, 1);
|
||||
|
||||
std::vector<Font::ColoredString> newtext;
|
||||
std::vector<love::font::ColoredString> newtext;
|
||||
luax_checkcoloredstring(L, 2, newtext);
|
||||
|
||||
luax_catchexcept(L, [&](){ t->set(newtext); });
|
||||
@@ -54,7 +54,7 @@ int w_TextBatch_setf(lua_State *L)
|
||||
if (!Font::getConstant(alignstr, align))
|
||||
return luax_enumerror(L, "align mode", Font::getConstants(align), alignstr);
|
||||
|
||||
std::vector<Font::ColoredString> newtext;
|
||||
std::vector<love::font::ColoredString> newtext;
|
||||
luax_checkcoloredstring(L, 2, newtext);
|
||||
|
||||
luax_catchexcept(L, [&](){ t->set(newtext, wraplimit, align); });
|
||||
@@ -68,7 +68,7 @@ int w_TextBatch_add(lua_State *L)
|
||||
|
||||
int index = 0;
|
||||
|
||||
std::vector<Font::ColoredString> text;
|
||||
std::vector<love::font::ColoredString> text;
|
||||
luax_checkcoloredstring(L, 2, text);
|
||||
|
||||
if (luax_istype(L, 3, math::Transform::type))
|
||||
@@ -102,7 +102,7 @@ int w_TextBatch_addf(lua_State *L)
|
||||
|
||||
int index = 0;
|
||||
|
||||
std::vector<Font::ColoredString> text;
|
||||
std::vector<love::font::ColoredString> text;
|
||||
luax_checkcoloredstring(L, 2, text);
|
||||
|
||||
float wrap = (float) luaL_checknumber(L, 3);
|
||||
|
||||
Reference in New Issue
Block a user