Huw Davies : gdi32: Fix fractional scaling threshold.
Alexandre Julliard
julliard at winehq.org
Fri Feb 20 12:49:43 CST 2009
Module: wine
Branch: master
Commit: ff2f88cf08f47c6e2c17e0475d7f3364dae730b1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ff2f88cf08f47c6e2c17e0475d7f3364dae730b1
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Feb 20 14:40:44 2009 +0000
gdi32: Fix fractional scaling threshold.
---
dlls/gdi32/freetype.c | 6 ++++--
dlls/gdi32/tests/font.c | 8 +++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 711f259..6ca35c3 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3627,8 +3627,10 @@ found:
scale = (height + face->size.height - 1) / face->size.height;
scaled_height = scale * face->size.height;
- /* XP allows not more than 10% deviation */
- if (scale > 1 && scaled_height - height > scaled_height / 10) scale--;
+ /* Only jump to the next height if the difference <= 25% original height */
+ if (scale > 2 && scaled_height - height > face->size.height / 4) scale--;
+ /* The jump between unscaled and doubled is delayed by 1 */
+ else if (scale == 2 && scaled_height - height > (face->size.height / 4 - 1)) scale--;
ret->scale_y = scale;
width = face->size.x_ppem >> 6;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 92623dc..5b50a14 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -344,7 +344,7 @@ static void test_bitmap_font(void)
bitmap_lf.lfWidth = lfWidth;
/* test fractional scaling */
- for (i = 1; i <= height_orig * 3; i++)
+ for (i = 1; i <= height_orig * 6; i++)
{
INT nearest_height;
@@ -352,8 +352,10 @@ static void test_bitmap_font(void)
hfont = create_font("fractional", &bitmap_lf);
scale = (i + height_orig - 1) / height_orig;
nearest_height = scale * height_orig;
- /* XP allows not more than 10% deviation */
- if (scale > 1 && nearest_height - i > nearest_height / 10) scale--;
+ /* Only jump to the next height if the difference <= 25% original height */
+ if (scale > 2 && nearest_height - i > height_orig / 4) scale--;
+ /* The jump between unscaled and doubled is delayed by 1 */
+ else if(scale == 2 && nearest_height - i > (height_orig / 4 - 1)) scale--;
old_hfont = SelectObject(hdc, hfont);
test_font_metrics(hdc, hfont, bitmap_lf.lfHeight, 0, test_str, sizeof(test_str), &tm_orig, &size_orig, width_orig, 1, scale);
SelectObject(hdc, old_hfont);
More information about the wine-cvs
mailing list