summaryrefslogtreecommitdiffstats
path: root/ui/gfx/platform_font_win.h
diff options
context:
space:
mode:
authorananta <ananta@chromium.org>2014-11-11 13:51:17 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-11 21:51:32 +0000
commita460202e0ad883cf70bd787349df0a12170f3eab (patch)
treebb1cf9d885e210ce4b0a76e9a1b266b6ee4bab52 /ui/gfx/platform_font_win.h
parent7bdf3eb7cce5411af3b2703f33dcef1e1307af20 (diff)
downloadchromium_src-a460202e0ad883cf70bd787349df0a12170f3eab.zip
chromium_src-a460202e0ad883cf70bd787349df0a12170f3eab.tar.gz
chromium_src-a460202e0ad883cf70bd787349df0a12170f3eab.tar.bz2
Set the antialiasing flag in the SkPaint structure used by the RenderTextHarfBuzz class before querying the font metrics from skia.
This ensures that skia does not return GDI compatible metrics from DirectWrite. The other change is to set the text size in the PlatformFontWin::CreateHFontRefFromSkia function in the SkPaint structure used for querying the font metrics from skia. The DirectWrite version of this function multiplies the text size with the DirectWrite metrics which ensures that the correct metrics are returned. This is noticeable in the omnibox where the text is not centered. The other change is to calculate the average character width using the text extents API. The GetDluBasX function has code to do this. Refactored into a helper function GetAverageCharWidthInDialogUnits and used that from the CreateHFontRefFromSkia function. This is needed because width of some widgets like FindBar etc relies on the character width containing a valid value. DirectWrite does not provide it in the metrics functions. Needs some investigation. BUG=389649, 431917 Review URL: https://codereview.chromium.org/703613005 Cr-Commit-Position: refs/heads/master@{#303727}
Diffstat (limited to 'ui/gfx/platform_font_win.h')
-rw-r--r--ui/gfx/platform_font_win.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h
index eaed10c..483dc89 100644
--- a/ui/gfx/platform_font_win.h
+++ b/ui/gfx/platform_font_win.h
@@ -112,6 +112,10 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
// Returns the average character width in dialog units.
int GetDluBaseX();
+ // Helper to return the average character width using the text extent
+ // technique mentioned here. http://support.microsoft.com/kb/125681.
+ static int GetAverageCharWidthInDialogUnits(HFONT gdi_font);
+
private:
friend class base::RefCounted<HFontRef>;
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback);