gdi32: Fix fractional scaling threshold.

This commit is contained in:
Huw Davies 2009-02-20 14:40:44 +00:00 committed by Alexandre Julliard
parent 0c6e37bb04
commit ff2f88cf08
2 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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);