Akihiro Sagawa : gdi32: Improve outline text metrics calculation, especially if unitsPerEm is not power of 2.
Alexandre Julliard
julliard at winehq.org
Thu Apr 4 13:54:16 CDT 2013
Module: wine
Branch: master
Commit: 3a9689106145c8585e917ae6f4f22226d87872ab
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3a9689106145c8585e917ae6f4f22226d87872ab
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Thu Mar 14 20:08:14 2013 +0900
gdi32: Improve outline text metrics calculation, especially if unitsPerEm is not power of 2.
---
dlls/gdi32/freetype.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 83e7ad8..7bc4366 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6775,7 +6775,7 @@ static BOOL get_outline_text_metrics(GdiFont *font)
TT_OS2 *pOS2;
TT_HoriHeader *pHori;
TT_Postscript *pPost;
- FT_Fixed x_scale, y_scale;
+ FT_Fixed em_scale;
WCHAR *family_nameW, *style_nameW, *face_nameW, *full_nameW;
char *cp;
INT ascent, descent;
@@ -6837,8 +6837,7 @@ static BOOL get_outline_text_metrics(GdiFont *font)
needed += lenfull;
- x_scale = ft_face->size->metrics.x_scale;
- y_scale = ft_face->size->metrics.y_scale;
+ em_scale = (FT_Fixed)MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM);
pOS2 = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2);
if(!pOS2) {
@@ -6878,8 +6877,8 @@ static BOOL get_outline_text_metrics(GdiFont *font)
font->ntmCellHeight = ascent + descent;
font->ntmAvgWidth = pOS2->xAvgCharWidth;
-#define SCALE_X(x) ((pFT_MulFix(x, x_scale) + 32) >> 6)
-#define SCALE_Y(y) ((pFT_MulFix(y, y_scale) + 32) >> 6)
+#define SCALE_X(x) (pFT_MulFix(x, em_scale))
+#define SCALE_Y(y) (pFT_MulFix(y, em_scale))
if(font->yMax) {
TM.tmAscent = font->yMax;
More information about the wine-cvs
mailing list