Chromium Code Reviews| Index: src/ports/SkFontHost_win.cpp |
| =================================================================== |
| --- src/ports/SkFontHost_win.cpp (revision 9035) |
| +++ src/ports/SkFontHost_win.cpp (working copy) |
| @@ -99,8 +99,11 @@ |
| * and since we have a cache of LOGFONTs for our tyepfaces, we always set the |
| * lfHeight to a canonical size, and then we use the 2x2 matrix to achieve the |
| * actual requested size. |
| + * |
| + * Not critical to match the font's upem, but we want it big enough to avoid |
| + * precision loss for GDI calls that return ints (e.g. GetOutlineFontMetrics). |
| */ |
| -static const int gCanonicalTextSize = 64; |
| +static const int gCanonicalTextSize = 2048; |
|
bungeman-skia
2013/05/07 19:56:08
Ick! Ah well, it used to be the magic number 64, t
|
| static void tchar_to_skstring(const TCHAR t[], SkString* s) { |
| #ifdef UNICODE |
| @@ -840,6 +843,13 @@ |
| if (!(mx || my)) |
| return; |
| + if (mx) { |
| + sk_bzero(mx, sizeof(*mx)); |
| + } |
| + if (my) { |
| + sk_bzero(my, sizeof(*my)); |
| + } |
| + |
| SkASSERT(fDDC); |
| if (fType == SkScalerContext_Windows::kBitmap_Type) { |
| @@ -848,8 +858,7 @@ |
| mx->fAscent = SkIntToScalar(-fTM.tmAscent); |
| mx->fDescent = -SkIntToScalar(fTM.tmDescent); |
| mx->fBottom = SkIntToScalar(fTM.tmDescent); |
| - mx->fLeading = SkIntToScalar(fTM.tmInternalLeading |
| - + fTM.tmExternalLeading); |
| + mx->fLeading = SkIntToScalar(fTM.tmExternalLeading); |
| } |
| if (my) { |
| @@ -857,8 +866,7 @@ |
| my->fAscent = SkIntToScalar(-fTM.tmAscent); |
| my->fDescent = SkIntToScalar(-fTM.tmDescent); |
| my->fBottom = SkIntToScalar(fTM.tmDescent); |
| - my->fLeading = SkIntToScalar(fTM.tmInternalLeading |
| - + fTM.tmExternalLeading); |
| + my->fLeading = SkIntToScalar(fTM.tmExternalLeading); |
| } |
| return; |
| } |
| @@ -875,21 +883,19 @@ |
| } |
| if (mx) { |
| - mx->fTop = -fScale * otm.otmTextMetrics.tmAscent; |
| + mx->fTop = -fScale * otm.otmrcFontBox.left; |
| mx->fAscent = -fScale * otm.otmAscent; |
| mx->fDescent = -fScale * otm.otmDescent; |
| - mx->fBottom = fScale * otm.otmTextMetrics.tmDescent; |
| - mx->fLeading = fScale * (otm.otmTextMetrics.tmInternalLeading |
| - + otm.otmTextMetrics.tmExternalLeading); |
| + mx->fBottom = fScale * otm.otmrcFontBox.right; |
| + mx->fLeading = fScale * otm.otmLineGap; |
| } |
| if (my) { |
| - my->fTop = -fScale * otm.otmTextMetrics.tmAscent; |
| + my->fTop = -fScale * otm.otmrcFontBox.top; |
| my->fAscent = -fScale * otm.otmAscent; |
|
bungeman-skia
2013/05/07 19:56:08
This ascent, descent, and leading look like they m
reed1
2013/05/07 21:04:49
x-height and avecharwidth -- done
SkFontMetrics d
|
| my->fDescent = -fScale * otm.otmDescent; |
| - my->fBottom = fScale * otm.otmTextMetrics.tmDescent; |
| - my->fLeading = fScale * (otm.otmTextMetrics.tmInternalLeading |
| - + otm.otmTextMetrics.tmExternalLeading); |
| + my->fBottom = fScale * otm.otmrcFontBox.bottom; |
| + my->fLeading = fScale * otm.otmLineGap; |
| } |
| } |