summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_main_runner.cc
diff options
context:
space:
mode:
authorananta <ananta@chromium.org>2014-11-14 15:30:31 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-14 23:30:56 +0000
commit420c045db8d79e2b114ef6339e1adc4d614ec96e (patch)
treea5b8a208bb16e18e65d2a8f23f648078113a352c /content/browser/browser_main_runner.cc
parentdcaa24e38a7d9b62b0449d1a025d5b9d2a9e3c8a (diff)
downloadchromium_src-420c045db8d79e2b114ef6339e1adc4d614ec96e.zip
chromium_src-420c045db8d79e2b114ef6339e1adc4d614ec96e.tar.gz
chromium_src-420c045db8d79e2b114ef6339e1adc4d614ec96e.tar.bz2
Fixed font metrics calculations if DirectWrite font rendering is enabled in the browser.
Fixes as below:- 1. The current code in the PlatformFontWin::CreateHFontRefFromSkia function was ceiling the ascent and descent before calculating the height of the font. We now use std::round(Descent - ascent) to mirror the logic in skia and RenderTextHarfBuzz. 2. Skia does not return all metrics we need like the capHeight which indicates the height of capital letters. This information is returned by DirectWrite. I added code to retrieve the font metrics from DirectWrite in the CreateFontRefFromSkia function and used this to calculate the cap height. The rest of the metrics are retrieved from skia as before. 3. We use the capHeight calculated in step 2 to calculate the internal leading value which is the leading space in the bounds for the glyph. The internal leading value is not returned by DirectWrite. We use this to calculate the font size which ensures that characters now show up in the desired size instead of giant size as seen today. 4. I removed the set_use_skia_for_font_metrics function from PlatformFontWin and added a new function SetDirectWriteFactory which is used to pass in the global directwrite factory by content. We use the factory to retrieve metrics from DirectWrite. BUG=432086, 431377, 432105 Review URL: https://codereview.chromium.org/721163003 Cr-Commit-Position: refs/heads/master@{#304293}
Diffstat (limited to 'content/browser/browser_main_runner.cc')
-rw-r--r--content/browser/browser_main_runner.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc
index 4a74b6e..39a8706 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -141,7 +141,7 @@ void MaybeEnableDirectWriteFontRendering() {
__uuidof(IDWriteFactory),
reinterpret_cast<IUnknown**>(&factory))));
SetDefaultSkiaFactory(SkFontMgr_New_DirectWrite(factory));
- gfx::PlatformFontWin::set_use_skia_for_font_metrics(true);
+ gfx::PlatformFontWin::SetDirectWriteFactory(factory);
}
}