Module: wine Branch: master Commit: a8d426e93a735a89c3116207d44b1fd4a82b2fd5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8d426e93a735a89c3116207d4...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Wed Jan 13 23:09:11 2016 +0900
gdi32: Implement synthesizing bold glyphs for bitmap fonts.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/freetype.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 569dc02..ea81ee1 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6917,8 +6917,10 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, }
metrics = ft_face->glyph->metrics; - if(font->fake_bold) - get_bold_glyph_outline(ft_face->glyph, font->ppem, &metrics); + if(font->fake_bold) { + if (!get_bold_glyph_outline(ft_face->glyph, font->ppem, &metrics) && metrics.width) + metrics.width += 1 << 6; + }
/* Some poorly-created fonts contain glyphs that exceed the boundaries set * by the text metrics. The proper behavior is to clip the glyph metrics to @@ -7068,7 +7070,17 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, INT w = min( pitch, (ft_face->glyph->bitmap.width + 7) >> 3 ); INT h = min( height, ft_face->glyph->bitmap.rows ); while(h--) { - memcpy(dst, src, w); + if (!font->fake_bold) + memcpy(dst, src, w); + else { + INT x; + dst[0] = 0; + for (x = 0; x < w; x++) { + dst[x ] = (dst[x] & 0x80) | (src[x] >> 1) | src[x]; + if (x+1 < pitch) + dst[x+1] = (src[x] & 0x01) << 7; + } + } src += ft_face->glyph->bitmap.pitch; dst += pitch; } @@ -7124,8 +7136,12 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, INT x; memset( buf, 0, needed ); while(h--) { - for(x = 0; x < pitch && x < ft_face->glyph->bitmap.width; x++) - if (src[x / 8] & masks[x % 8]) dst[x] = max_level; + for(x = 0; x < pitch && x < ft_face->glyph->bitmap.width; x++) { + if (src[x / 8] & masks[x % 8]) { + dst[x] = max_level; + if (font->fake_bold && x+1 < pitch) dst[x+1] = max_level; + } + } src += ft_face->glyph->bitmap.pitch; dst += pitch; } @@ -7199,7 +7215,10 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, for (x = 0; x < width && x < ft_face->glyph->bitmap.width; x++) { if ( src[x / 8] & masks[x % 8] ) + { ((unsigned int *)dst)[x] = ~0u; + if (font->fake_bold && x+1 < width) ((unsigned int *)dst)[x+1] = ~0u; + } } src += src_pitch; dst += pitch;