Index: ui/gfx/platform_font_win.cc |
diff --git a/ui/gfx/platform_font_win.cc b/ui/gfx/platform_font_win.cc |
index a9a7a43faf5f6ec43d5f3ab7ff03029c19195773..9a154a4a6a39ba9a3a0faa44fd2b17e87f77364e 100644 |
--- a/ui/gfx/platform_font_win.cc |
+++ b/ui/gfx/platform_font_win.cc |
@@ -98,8 +98,14 @@ Font PlatformFontWin::DeriveFontWithHeight(int height, int style) { |
if (GetHeight() > height) { |
const int min_font_size = GetMinimumFontSize(); |
Font font = DeriveFont(-1, style); |
- while (font.GetHeight() > height && font.GetFontSize() != min_font_size) { |
+ int font_height = font.GetHeight(); |
+ int font_size = font.GetFontSize(); |
+ while (font_height > height && font_size != min_font_size) { |
font = font.DeriveFont(-1, style); |
+ if (font_height == font.GetHeight() && font_size == font.GetFontSize()) |
+ break; |
+ font_height = font.GetHeight(); |
+ font_size = font.GetFontSize(); |
} |
return font; |
} |
@@ -193,8 +199,8 @@ void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { |
void PlatformFontWin::InitWithFontNameAndSize(const std::string& font_name, |
int font_size) { |
- HFONT hf = ::CreateFont(-font_size, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
- UTF8ToUTF16(font_name).c_str()); |
+ HFONT hf = ::CreateFont(-font_size, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, 0, |
msw
2012/10/12 21:34:55
1) Will this fail on font-name/charset conflict or
|
+ 0, 0, 0, UTF8ToUTF16(font_name).c_str()); |
font_ref_ = CreateHFontRef(hf); |
} |