From f35cbdff906b265712afffc8831bafe5fbb21f3b Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 22 Jan 2014 17:13:04 +0800 Subject: [PATCH] add bold glyph rendering in freetype2 --- ffi/freetype.lua | 3 ++- ffi/freetype_h.lua | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ffi/freetype.lua b/ffi/freetype.lua index d5e9ee95a..9f46462d6 100644 --- a/ffi/freetype.lua +++ b/ffi/freetype.lua @@ -27,9 +27,10 @@ function FTFace_mt.__index:checkGlyph(char) end end -function FTFace_mt.__index:renderGlyph(char, bgcolor, fgcolor) +function FTFace_mt.__index:renderGlyph(char, bgcolor, fgcolor, bold) assert(ft2.FT_Load_Char(self, char, ft2.FT_LOAD_RENDER) == 0, "freetype error") + if bold then ft2.FT_GlyphSlot_Embolden(self.glyph) end local bitmap = self.glyph.bitmap local glyph = { bb = Blitbuffer.new(bitmap.width, bitmap.rows), diff --git a/ffi/freetype_h.lua b/ffi/freetype_h.lua index 9794df55b..a43afe859 100644 --- a/ffi/freetype_h.lua +++ b/ffi/freetype_h.lua @@ -229,4 +229,5 @@ int FT_Get_Kerning(struct FT_FaceRec_ *, unsigned int, unsigned int, unsigned in static const int FT_LOAD_RENDER = 4; static const int FT_FACE_FLAG_KERNING = 64; static const int FT_KERNING_DEFAULT = 0; +void FT_GlyphSlot_Embolden(FT_GlyphSlot slot); ]]