• ananta's avatar
    For DirectWrite font metrics use the average character width from the TEXTMETRIC structure. · 08526340
    ananta authored
    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}
    08526340
platform_font_win.cc 21.8 KB