commit | aa051ee8d1a7ff725225d783d1a96663d5aedb08 | [log] [tgz] |
---|---|---|
author | stapelberg <stapelberg@google.com> | Thu Mar 19 22:40:36 2015 |
committer | Commit bot <commit-bot@chromium.org> | Thu Mar 19 22:41:31 2015 |
tree | 6b946d4152566239ccda338eba76edf27f8a9923 | |
parent | cd34266e673171ffd426ad7768798287fa12bd92 [diff] |
Fix Pango font rendering with HiDPi displays on Linux. Don’t scale fonts up twice when running with device_scale_factor > 1.0. Chrome’s UI is scaled up to device_scale_factor (e.g. 2x) by calling SkCanvas->scale(). See Chrome’s gfx::Canvas class which calls canvas.scale(image_scale, image_scale): https://code.google.com/p/chromium/codesearch#chromium/src/ui/gfx/canvas.cc Here is a skia fiddle which renders text with .setTextSize(21): https://fiddle.skia.org/c/098cb32edac7e394aba5b9ff4c08b06c Here is the same fiddle, but calling canvas.Scale(2.0, 2.0) before rendering to simulate what Chrome does: https://fiddle.skia.org/c/a7b456338776239278e398741e1098d9 As you can see, the text is twice as large. Therefore, this commit changes Chrome to take into account the DPI that GTK provides, but set it in perspective to the device scale factor. This preserves the same behavior when device scale factor == 1 but yields correct rendering when device scale factor > 1.0 (hi-dpi displays). Before this change: http://t.zekjur.net/chrome-hidpi-enabled.png After this change: http://t.zekjur.net/chrome-hidpi-enabled-scalefix.png This change also enables subpixel rendering on HiDPi displays, which is what Chrome OS also does. Without subpixel rendering: http://t.zekjur.net/without-subpixel.png With subpixel rendering: http://t.zekjur.net/with-subpixel.png BUG=143619 Review URL: https://codereview.chromium.org/929733002 Cr-Commit-Position: refs/heads/master@{#321457}