diff options
author | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 21:18:11 +0000 |
---|---|---|
committer | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 21:18:11 +0000 |
commit | 2a36be1ac4334ffffa401b69c9fbe6885973a769 (patch) | |
tree | 9dfede97c8bf2bda7d686ae20f4d6b0e5dca71b3 /ui/views/controls | |
parent | 218514fbdd7a4ee4720971866d83513a66cb5ddc (diff) | |
download | chromium_src-2a36be1ac4334ffffa401b69c9fbe6885973a769.zip chromium_src-2a36be1ac4334ffffa401b69c9fbe6885973a769.tar.gz chromium_src-2a36be1ac4334ffffa401b69c9fbe6885973a769.tar.bz2 |
Fix RenderTextWin CJK font linking size on Windows XP.
On Windows XP, the new font must be picked such that the font height, not the font size, is the same as the previous font.
Add a PlatformFontWin::DeriveFontWithHeight() function that provided the functionality needed for the above and modifies PlatformFontWin to support the above by not assuming LOGFONT.lfHeight is always negative. Instead, it now gets the font size from TEXTMETRIC.
One side effect of this change is that the GetFontSize() will now return the actual font size that will be used, rather than the input parameter when creating the font. A test in label_unittest.cc depended on this and is updated as part of this CL.
BUG=122143, 105550
TEST=Run Chrome on English Windows XP with CJK languages
installed. Go to a website with a Chinese title. The size
of the Chinese text in the tab title should be the same
as in Chrome 19 (which has use_canvas_skia=0 setting).
Also, existing unit tests and newly-added platform_font_win_unittest.cc.
Review URL: http://codereview.chromium.org/10228009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r-- | ui/views/controls/label_unittest.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc index a58a32b..df7ac33 100644 --- a/ui/views/controls/label_unittest.cc +++ b/ui/views/controls/label_unittest.cc @@ -16,18 +16,19 @@ namespace views { // All text sizing measurements (width and height) should be greater than this. const int kMinTextDimension = 4; -#if defined(OS_WIN) -// Courier is failing on linux because it's non scalable. TEST(LabelTest, FontPropertyCourier) { Label label; std::string font_name("courier"); - gfx::Font font(font_name, 30); + // Note: This test is size dependent since Courier does not support all sizes. + gfx::Font font(font_name, 26); label.SetFont(font); gfx::Font font_used = label.font(); +#if defined(OS_WIN) + // On Linux, this results in "Sans" instead of "courier". EXPECT_EQ(font_name, font_used.GetFontName()); - EXPECT_EQ(30, font_used.GetFontSize()); -} #endif + EXPECT_EQ(26, font_used.GetFontSize()); +} TEST(LabelTest, FontPropertyArial) { Label label; |