diff options
author | jochen <jochen@chromium.org> | 2015-01-13 23:48:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-14 07:49:15 +0000 |
commit | ab0d2cafe050202ea69bbf4dfd9a6f6a39584a44 (patch) | |
tree | 3edb995b65991ba3f80ca8d0877474f2d4a8cf73 /ui/gfx/platform_font_win.h | |
parent | 089c3ddeec583fd9e11564727a9695b70657e681 (diff) | |
download | chromium_src-ab0d2cafe050202ea69bbf4dfd9a6f6a39584a44.zip chromium_src-ab0d2cafe050202ea69bbf4dfd9a6f6a39584a44.tar.gz chromium_src-ab0d2cafe050202ea69bbf4dfd9a6f6a39584a44.tar.bz2 |
Revert of Relanding this with font test fixes for gdi. (patchset #7 id:120001 of https://codereview.chromium.org/853553002/)
Reason for revert:
still fails on XP
https://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%281%29/builds/34996/steps/gfx_unittests/logs/DeriveFontWithHeight
Original issue's description:
> Relanding this with font test fixes for gdi.
>
> Get all font unittests running with DirectWrite on Windows 7+
>
> Fixes as per below:-
> 1. Remove the addition of the fLeading value when calculating the height for the font
> with DirectWrite. fAscent + fDescent is the height of the font and adding the fLeading
> value to it returns the spacing between lines which is not what we are looking for.
>
> 2. The FontListTest.Fonts_GetHeight_GetBaseline unittest has a condition which basically validates
> whether the difference between the font height and the baseline is different for Arial and Symbol
> fonts. This fails for DirectWrite and fails for GDI with font sizes like 50, etc. Replaced this check
> with a check for the font heights are different.
>
> 3. Reworked the PlatformFontWinTest.DeriveFontWithHeight test to ensure it passes for DirectWrite and GDI.
>
> 4. Ensure that the PlatformFontWin::DeriveFontWithHeight function honors the minimum font size constraint
> in all cases.
>
> BUG=442010
> R=msw
>
> Committed: https://crrev.com/3e05f41653bf36cce40718d8295ce2293218dab6
> Cr-Commit-Position: refs/heads/master@{#311388}
TBR=msw@chromium.org,ananta@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=442010
Review URL: https://codereview.chromium.org/847283003
Cr-Commit-Position: refs/heads/master@{#311424}
Diffstat (limited to 'ui/gfx/platform_font_win.h')
-rw-r--r-- | ui/gfx/platform_font_win.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h index 6f7bc21..11f94d4 100644 --- a/ui/gfx/platform_font_win.h +++ b/ui/gfx/platform_font_win.h @@ -49,10 +49,11 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont { // name could not be retrieved, returns GetFontName(). std::string GetLocalizedFontName() const; - // Returns a derived Font with the specified |style| and maximum |height|. - // The returned Font will be the largest font size with a height <= |height|, - // since a size with the exact specified |height| may not necessarily exist. - // GetMinimumFontSize() may impose a font size that is taller than |height|. + // Returns a derived Font with the specified |style| and with height at most + // |height|. If the height and style of the receiver already match, it is + // returned. Otherwise, the returned Font will have the largest size such that + // its height is less than or equal to |height| (since there may not exist a + // size that matches the exact |height| specified). Font DeriveFontWithHeight(int height, int style); // Overridden from PlatformFont: @@ -171,6 +172,10 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont { static HFontRef* CreateHFontRefFromGDI(HFONT font, const TEXTMETRIC& font_metrics); + // Returns a largest derived Font whose height does not exceed the height of + // |base_font|. + static Font DeriveWithCorrectedSize(HFONT base_font); + // Creates and returns a new HFontRef from the specified HFONT using metrics // from skia. Currently this is only used if we use DirectWrite for font // metrics. |