Commit ff2f88cf authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Fix fractional scaling threshold.

parent 0c6e37bb
...@@ -3627,8 +3627,10 @@ found: ...@@ -3627,8 +3627,10 @@ found:
scale = (height + face->size.height - 1) / face->size.height; scale = (height + face->size.height - 1) / face->size.height;
scaled_height = scale * face->size.height; scaled_height = scale * face->size.height;
/* XP allows not more than 10% deviation */ /* Only jump to the next height if the difference <= 25% original height */
if (scale > 1 && scaled_height - height > scaled_height / 10) scale--; 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; ret->scale_y = scale;
width = face->size.x_ppem >> 6; width = face->size.x_ppem >> 6;
......
...@@ -344,7 +344,7 @@ static void test_bitmap_font(void) ...@@ -344,7 +344,7 @@ static void test_bitmap_font(void)
bitmap_lf.lfWidth = lfWidth; bitmap_lf.lfWidth = lfWidth;
/* test fractional scaling */ /* test fractional scaling */
for (i = 1; i <= height_orig * 3; i++) for (i = 1; i <= height_orig * 6; i++)
{ {
INT nearest_height; INT nearest_height;
...@@ -352,8 +352,10 @@ static void test_bitmap_font(void) ...@@ -352,8 +352,10 @@ static void test_bitmap_font(void)
hfont = create_font("fractional", &bitmap_lf); hfont = create_font("fractional", &bitmap_lf);
scale = (i + height_orig - 1) / height_orig; scale = (i + height_orig - 1) / height_orig;
nearest_height = scale * height_orig; nearest_height = scale * height_orig;
/* XP allows not more than 10% deviation */ /* Only jump to the next height if the difference <= 25% original height */
if (scale > 1 && nearest_height - i > nearest_height / 10) scale--; 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); 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); 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); SelectObject(hdc, old_hfont);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment