Relanding this with font test fixes for gdi font tests on XP
commitfa8f88074507066c0dd61fcdf6e4154a89d0ba70
authorananta <ananta@chromium.org>
Thu, 15 Jan 2015 00:56:11 +0000 (14 16:56 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 15 Jan 2015 00:57:10 +0000 (15 00:57 +0000)
tree6745b425b3dce889d4b41f387f04e95f4b66e6a1
parent8dd76f43b91ba23d6b5dfc49efd74fbafc3deee2
Relanding this with font test fixes for gdi font tests on XP

Get all font unittests running with DirectWrite on Windows 7+

Fixes as per below:-
1. Remove the addition of the fLeading value when calculating the height for the font
   with DirectWrite. fAscent + fDescent is the height of the font and adding the fLeading
   value to it returns the spacing between lines which is not what we are looking for.

2. The FontListTest.Fonts_GetHeight_GetBaseline unittest has a condition which basically validates
   whether the difference between the font height and the baseline is different for Arial and Symbol
   fonts. This fails for DirectWrite and fails for GDI with font sizes like 50, etc. Replaced this check
   with a check for the font heights are different.

3. Reworked the PlatformFontWinTest.DeriveFontWithHeight test to ensure it passes for DirectWrite and GDI.

4. Ensure that the PlatformFontWin::DeriveFontWithHeight function honors the minimum font size constraint
   in all cases.

5. Return a derived font from the DeriveFontWithHeight function if it matches the font size.

5. Ensure that the requested_font_size_ member in the HFontRef structure is set to the correct font size by going
   through the text metrics API. This is required because for small font sizes, the size as reported by LOGFONT is not correct.
   For e.g. if the height is -1, the actual font size is 2 on my XP machine. This causes the DeriveFontWithHeight test to fail.

BUG=442010
R=msw

Review URL: https://codereview.chromium.org/849043002

Cr-Commit-Position: refs/heads/master@{#311594}
ui/gfx/font_list_unittest.cc
ui/gfx/platform_font_win.cc
ui/gfx/platform_font_win.h
ui/gfx/platform_font_win_unittest.cc