mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Move sdf option to settings table
This commit is contained in:
@@ -147,6 +147,7 @@ protected:
|
||||
|
||||
FontMetrics metrics;
|
||||
float dpiScale;
|
||||
bool sdf;
|
||||
|
||||
}; // Rasterizer
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
{
|
||||
Hinting hinting = HINTING_NORMAL;
|
||||
OptionalFloat dpiScale;
|
||||
bool sdf = false;
|
||||
};
|
||||
|
||||
virtual ~TrueTypeRasterizer() {}
|
||||
|
||||
@@ -40,6 +40,8 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, love::Data *data, int
|
||||
dpiScale = settings.dpiScale.get(defaultdpiscale);
|
||||
size = floorf(size * dpiScale + 0.5f);
|
||||
|
||||
sdf = settings.sdf;
|
||||
|
||||
if (size <= 0)
|
||||
throw love::Exception("Invalid TrueType font size: %d", size);
|
||||
|
||||
@@ -121,7 +123,11 @@ GlyphData *TrueTypeRasterizer::getGlyphDataForIndex(int index) const
|
||||
FT_Render_Mode rendermode = FT_RENDER_MODE_NORMAL;
|
||||
if (hinting == HINTING_MONO)
|
||||
rendermode = FT_RENDER_MODE_MONO;
|
||||
<<<<<<< Updated upstream
|
||||
else if (hinting == HINTING_SDF)
|
||||
=======
|
||||
else if (sdf == true)
|
||||
>>>>>>> Stashed changes
|
||||
rendermode = FT_RENDER_MODE_SDF;
|
||||
|
||||
err = FT_Glyph_To_Bitmap(&ftglyph, rendermode, 0, 1);
|
||||
@@ -138,6 +144,10 @@ GlyphData *TrueTypeRasterizer::getGlyphDataForIndex(int index) const
|
||||
throw love::Exception("TrueType Font glyph error: FT_Glyph_To_Bitmap failed (0x%x)", err);
|
||||
}
|
||||
}
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph) ftglyph;
|
||||
const FT_Bitmap &bitmap = bitmap_glyph->bitmap; //just to make things easier
|
||||
|
||||
|
||||
@@ -95,6 +95,11 @@ static TrueTypeRasterizer::Settings luax_checktruetypesettings(lua_State* L, int
|
||||
if (!lua_isnoneornil(L, -1))
|
||||
s.dpiScale.set((float)luaL_checknumber(L, -1));
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_getfield(L, startidx, "sdf");
|
||||
if (!lua_isnoneornil(L, -1))
|
||||
s.sdf = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user