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

Issue 10228009: Fix CJK font linking size on Windows XP. (Closed)

Created:
8 years, 8 months ago by Alexei Svitkine (slow)
Modified:
8 years, 7 months ago
Reviewers:
msw, sky
CC:
chromium-reviews
Visibility:
Public.

Description

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. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=134600

Patch Set 1 : #

Total comments: 10

Patch Set 2 : #

Patch Set 3 : #

Total comments: 29

Patch Set 4 : #

Total comments: 6

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Total comments: 12

Patch Set 8 : #

Patch Set 9 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -32 lines) Patch
M ui/gfx/platform_font_win.h View 1 2 3 4 5 6 7 5 chunks +16 lines, -1 line 0 comments Download
M ui/gfx/platform_font_win.cc View 1 2 3 4 5 6 7 8 7 chunks +56 lines, -16 lines 1 comment Download
A ui/gfx/platform_font_win_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +95 lines, -0 lines 0 comments Download
M ui/gfx/render_text_win.cc View 1 2 3 4 5 6 7 4 chunks +24 lines, -8 lines 0 comments Download
M ui/ui_unittests.gypi View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M ui/views/controls/label_unittest.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -5 lines 0 comments Download

Messages

Total messages: 29 (0 generated)
Alexei Svitkine (slow)
8 years, 8 months ago (2012-04-25 21:06:16 UTC) #1
msw
I'm so sorry... http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc#newcode120 ui/gfx/render_text_win.cc:120: // Chooses the largest font size ...
8 years, 8 months ago (2012-04-25 22:07:31 UTC) #2
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc#newcode122 ui/gfx/render_text_win.cc:122: void DeriveFontWithHeight(int font_height, int font_style, gfx::Font* font) { On ...
8 years, 8 months ago (2012-04-25 23:19:31 UTC) #3
msw
http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc File ui/gfx/render_text_win.cc (right): http://codereview.chromium.org/10228009/diff/1002/ui/gfx/render_text_win.cc#newcode122 ui/gfx/render_text_win.cc:122: void DeriveFontWithHeight(int font_height, int font_style, gfx::Font* font) { On ...
8 years, 8 months ago (2012-04-25 23:35:41 UTC) #4
Alexei Svitkine (slow)
Looks like Win32's CreateFontIndirect() can create a font based on a given height, which makes ...
8 years, 8 months ago (2012-04-26 15:36:35 UTC) #5
msw
Nice find!
8 years, 8 months ago (2012-04-26 17:18:23 UTC) #6
Alexei Svitkine (slow)
Updated. PTAL. +sky for PlatformFontWin and ui/ui_unittests.gypi changes.
8 years, 8 months ago (2012-04-26 18:33:58 UTC) #7
sky
LGTM
8 years, 8 months ago (2012-04-26 19:08:50 UTC) #8
Alexei Svitkine (slow)
One side effect of this change is that the GetFontSize() will now return the actual ...
8 years, 8 months ago (2012-04-26 19:53:23 UTC) #9
msw
Alexei, you really rock! http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc#newcode53 ui/gfx/platform_font_win.cc:53: ((font_style & gfx::Font::UNDERLINED) == gfx::Font::UNDERLINED); ...
8 years, 8 months ago (2012-04-26 21:04:42 UTC) #10
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc#newcode53 ui/gfx/platform_font_win.cc:53: ((font_style & gfx::Font::UNDERLINED) == gfx::Font::UNDERLINED); On 2012/04/26 21:04:42, msw ...
8 years, 8 months ago (2012-04-26 21:45:56 UTC) #11
msw
http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/12003/ui/gfx/platform_font_win.cc#newcode226 ui/gfx/platform_font_win.cc:226: return new HFontRef(font, font_size, height, baseline, ave_char_width, style); > ...
8 years, 8 months ago (2012-04-26 22:14:13 UTC) #12
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/14006/ui/gfx/platform_font_win_unittest.cc File ui/gfx/platform_font_win_unittest.cc (right): http://codereview.chromium.org/10228009/diff/14006/ui/gfx/platform_font_win_unittest.cc#newcode55 ui/gfx/platform_font_win_unittest.cc:55: TEST(PlatformFontWinTest, DeriveFontWithHeight) { On 2012/04/26 22:14:13, msw wrote: > ...
8 years, 8 months ago (2012-04-26 22:22:29 UTC) #13
msw
LGTM (with suggested comments). Send mail again when you push the new Patch Set(s), but ...
8 years, 8 months ago (2012-04-26 22:25:16 UTC) #14
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/14006/ui/gfx/platform_font_win_unittest.cc File ui/gfx/platform_font_win_unittest.cc (right): http://codereview.chromium.org/10228009/diff/14006/ui/gfx/platform_font_win_unittest.cc#newcode55 ui/gfx/platform_font_win_unittest.cc:55: TEST(PlatformFontWinTest, DeriveFontWithHeight) { On 2012/04/26 22:14:13, msw wrote: > ...
8 years, 8 months ago (2012-04-27 15:15:26 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/10228009/24001
8 years, 8 months ago (2012-04-27 15:17:23 UTC) #16
commit-bot: I haz the power
Try job failure for 10228009-24001 (retry) on win_rel for step "gfx_unittests". It's a second try, ...
8 years, 8 months ago (2012-04-27 17:48:29 UTC) #17
Alexei Svitkine (slow)
Hmm. Looks like I had a non-default font size set, for which the new test ...
8 years, 8 months ago (2012-04-27 21:02:21 UTC) #18
Alexei Svitkine (slow)
On 2012/04/27 21:02:21, Alexei Svitkine wrote: > Hmm. Looks like I had a non-default font ...
8 years, 8 months ago (2012-04-27 21:15:14 UTC) #19
msw
On 2012/04/27 21:15:14, Alexei Svitkine wrote: > On 2012/04/27 21:02:21, Alexei Svitkine wrote: > > ...
8 years, 8 months ago (2012-04-27 22:01:56 UTC) #20
Alexei Svitkine (slow)
On Fri, Apr 27, 2012 at 6:01 PM, <msw@chromium.org> wrote: > On 2012/04/27 21:15:14, Alexei ...
8 years, 7 months ago (2012-04-28 14:31:44 UTC) #21
Alexei Svitkine (slow)
I've updated the CL. It now passes the test in all cases and fixes the ...
8 years, 7 months ago (2012-04-30 15:09:26 UTC) #22
msw
http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc#newcode92 ui/gfx/platform_font_win.cc:92: if (GetHeight() > height) { Should this heed the ...
8 years, 7 months ago (2012-04-30 17:40:00 UTC) #23
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc#newcode92 ui/gfx/platform_font_win.cc:92: if (GetHeight() > height) { On 2012/04/30 17:40:01, msw ...
8 years, 7 months ago (2012-04-30 17:49:14 UTC) #24
msw
http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc#newcode92 ui/gfx/platform_font_win.cc:92: if (GetHeight() > height) { On 2012/04/30 17:49:14, Alexei ...
8 years, 7 months ago (2012-04-30 18:55:39 UTC) #25
Alexei Svitkine (slow)
http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/46005/ui/gfx/platform_font_win.cc#newcode92 ui/gfx/platform_font_win.cc:92: if (GetHeight() > height) { On 2012/04/30 18:55:39, msw ...
8 years, 7 months ago (2012-04-30 19:24:00 UTC) #26
msw
LGTM with optional nit. http://codereview.chromium.org/10228009/diff/35007/ui/gfx/platform_font_win.cc File ui/gfx/platform_font_win.cc (right): http://codereview.chromium.org/10228009/diff/35007/ui/gfx/platform_font_win.cc#newcode101 ui/gfx/platform_font_win.cc:101: while (font.GetHeight() > height && ...
8 years, 7 months ago (2012-04-30 19:30:23 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/10228009/35007
8 years, 7 months ago (2012-04-30 19:31:53 UTC) #28
commit-bot: I haz the power
8 years, 7 months ago (2012-04-30 21:18:14 UTC) #29
Change committed as 134600

Powered by Google App Engine
This is Rietveld 408576698