Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Issue 692633003: Use the correct font metrics in base PlatformFontWin if DirectWrite is used in the browser for font… (Closed)

Created:
6 years, 1 month ago by ananta
Modified:
6 years, 1 month ago
Reviewers:
sky, scottmg
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Use the correct font metrics in base PlatformFontWin if DirectWrite is used in the browser for font metrics. The PlatformFontWin class uses GDI for creating fonts and their metrics. If DirectWrite is used for font metrics then the metrics returned by GDI for the fonts and those calculated by skia using DirectWrite differ leading to text getting clipped etc. DirectWrite provides an interface IDWriteGdiInterop for interoperability with GDI. Converting the GDI font to a DirectWrite font face object (IDWriteFontFace) and then converting this back to a GDI font gives us the correct metrics. The other option could be to create a PlatformFontSkia class on the same lines as PlatformFontWin and use skia to get the font metrics. The amount of work needed there is unkown. We could look at this as a possible alternative in case the above approach does not work. Changes in this patch are as below:- 1. We use DirectWrite to create a IDWriteFactory interface in content browser. This is passed down to skia as the default factory. 2. The factory created in step 1 is also passsed via a static setter function to the PlatformFontWin class. The presence of a non NULL IDWriteFactory interface is used by this class to create a DirectWrite metrics compatible GDI font. 3. HarfBuzz text rendering is enabled by default in the browser. The MaybeEnableDirectWriteFontRendering function now checks for the disable harfbuzz text rendering switch instead. BUG=427804, 427802 Committed: https://crrev.com/9fd5754d8c121d7c6fbc5b88d361a1c3e0d03900 Cr-Commit-Position: refs/heads/master@{#301987}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Code review comments from scottmg #

Total comments: 2

Patch Set 3 : Code review comments from sky #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -3 lines) Patch
M content/browser/browser_main_runner.cc View 1 2 2 chunks +22 lines, -3 lines 0 comments Download
M ui/gfx/platform_font_win.h View 4 chunks +17 lines, -0 lines 0 comments Download
M ui/gfx/platform_font_win.cc View 4 chunks +45 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
ananta
6 years, 1 month ago (2014-10-29 21:26:13 UTC) #2
scottmg
lgtm https://codereview.chromium.org/692633003/diff/1/content/browser/browser_main_runner.cc File content/browser/browser_main_runner.cc (right): https://codereview.chromium.org/692633003/diff/1/content/browser/browser_main_runner.cc#newcode136 content/browser/browser_main_runner.cc:136: return; no return https://codereview.chromium.org/692633003/diff/1/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): https://codereview.chromium.org/692633003/diff/1/ui/gfx/platform_font_win.cc#newcode321 ...
6 years, 1 month ago (2014-10-29 21:33:33 UTC) #3
ananta
https://codereview.chromium.org/692633003/diff/1/content/browser/browser_main_runner.cc File content/browser/browser_main_runner.cc (right): https://codereview.chromium.org/692633003/diff/1/content/browser/browser_main_runner.cc#newcode136 content/browser/browser_main_runner.cc:136: return; On 2014/10/29 21:33:32, scottmg wrote: > no return ...
6 years, 1 month ago (2014-10-29 21:56:18 UTC) #4
sky
LGTM https://codereview.chromium.org/692633003/diff/20001/content/browser/browser_main_runner.cc File content/browser/browser_main_runner.cc (right): https://codereview.chromium.org/692633003/diff/20001/content/browser/browser_main_runner.cc#newcode135 content/browser/browser_main_runner.cc:135: CHECK(false); CHECK(dwrite_create_factory_proc)?
6 years, 1 month ago (2014-10-29 22:04:32 UTC) #5
ananta
https://codereview.chromium.org/692633003/diff/20001/content/browser/browser_main_runner.cc File content/browser/browser_main_runner.cc (right): https://codereview.chromium.org/692633003/diff/20001/content/browser/browser_main_runner.cc#newcode135 content/browser/browser_main_runner.cc:135: CHECK(false); On 2014/10/29 22:04:32, sky wrote: > CHECK(dwrite_create_factory_proc)? Done.
6 years, 1 month ago (2014-10-29 22:25:35 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/692633003/40001
6 years, 1 month ago (2014-10-29 22:48:12 UTC) #8
commit-bot: I haz the power
Committed patchset #3 (id:40001)
6 years, 1 month ago (2014-10-30 00:14:51 UTC) #9
commit-bot: I haz the power
6 years, 1 month ago (2014-10-30 00:15:40 UTC) #10
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/9fd5754d8c121d7c6fbc5b88d361a1c3e0d03900
Cr-Commit-Position: refs/heads/master@{#301987}

Powered by Google App Engine
This is Rietveld 408576698