For DirectWrite font metrics use the average character width from the TEXTMETRIC...
commit0852634071b072ab41e1b255075652cf4c29a0df
authorananta <ananta@chromium.org>
Thu, 29 Jan 2015 22:00:19 +0000 (29 14:00 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 29 Jan 2015 22:01:57 +0000 (29 22:01 +0000)
tree8bdf6aafba3de323a9c2ccfef5b8d9ed8b39a7bb
parentcd189c1c20e7a61442142b3cf02b99b28870553f
For DirectWrite font metrics use the average character width from the TEXTMETRIC structure.

Currently we fetch the average character width from the GetTextExtentPoint32 API for DirectWrite as skia
does not return this value. The width returned by the GetTextExtentPoint32 API is 1 px larger than the one
reported by the TEXTMETRIC structure causing some dialogs like the bookmark editor to display much larger than that
with GDI.

We now use the average character width from the TEXTMETRIC structure while reporting back the metrics for DirectWrite
fonts. Longer term fix is to find out a way to calculate this from DirectWrite. Does not appear to be straigthforward.
Added a TODO to that effect in the code.

BUG=434588
TEST=Updated the PlatformFontWinTest.Metrics_SkiaVersusGDI test to validate the average character widths.
For manual test, launch Chrome and open the bookmark
editor on Windows 7+. Observe that the window size is larger than the window size when using GDI for fonts.

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

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