Index: ui/gfx/platform_font_win.cc |
diff --git a/ui/gfx/platform_font_win.cc b/ui/gfx/platform_font_win.cc |
index 4acaf64b34abdb2ff9abb8b0755e588741f8f1e1..58360ae72b7c6f4fc24bce0a4280013e287e1b9e 100644 |
--- a/ui/gfx/platform_font_win.cc |
+++ b/ui/gfx/platform_font_win.cc |
@@ -116,7 +116,20 @@ Font PlatformFontWin::DeriveFontWithHeight(int height, int style) { |
SetLogFontStyle(style, &font_info); |
HFONT hfont = CreateFontIndirect(&font_info); |
- return Font(new PlatformFontWin(CreateHFontRef(hfont))); |
+ Font best_font(new PlatformFontWin(CreateHFontRef(hfont))); |
+ int best_font_height = best_font.GetHeight(); |
+ |
+ while (best_font_height <= height) { |
msw
2014/05/29 21:34:41
Is it possible (and more efficient) to first guess
|
+ Font font = best_font.Derive(1, style); |
+ int font_height = font.GetHeight(); |
+ if (font_height > height) { |
+ break; |
+ } |
+ best_font = font; |
+ best_font_height = font_height; |
+ } |
+ |
+ return best_font; |
} |
//////////////////////////////////////////////////////////////////////////////// |