Skip to content

Commit

Permalink
add bold glyph rendering in freetype2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox committed Jan 22, 2014
1 parent efebd24 commit f35cbdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ffi/freetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions ffi/freetype_h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
]]

0 comments on commit f35cbdf

Please sign in to comment.