|
楼主 |
发表于 2006-1-1 01:26:08
|
显示全部楼层
日月的上面两个补丁,利用原理是先从freetype库调用取出矢量字体的画字位图,
用该位图构建一个点阵字体,然后再传入freetype,调用FT_GlyphSlot_Embolden
函数加粗字体,他利用了freetype的伪粗体的一个特性,即矢量字和点阵字伪粗体
在freetype中实现算法不同,点阵字体粗体更好看一些。
libXft-2.1.7-lazy-embolden.diff补丁中有个bug,因为用上面方法构建字体时,
忘了将改变的参数保存回去,所以出现中文和英文参差不齐的结果。
修改方法如下:
+ if (subpixel)
+ FT_Outline_Transform (&glyphslot->outline, &matrix);
+ FT_Outline_Translate ( &glyphslot->outline, -left*hmul, -bottom*vmul );
+ FT_Outline_Get_Bitmap( _XftFTlibrary, &glyphslot->outline, &glyphslot->bitmap);
+
+ glyphslot->format = ft_glyph_format_bitmap;
+ FT_GlyphSlot_Embolden (glyphslot);
//在这里插入
xftg->metrics.x = -TRUNC(left);
xftg->metrics.y = TRUNC(top);
+ }
+#endif
见效果图
 |
|