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

Unified Diff: ui/gfx/platform_font_win.cc

Issue 11087016: Create font with DEFAULT_CHARSET instead of ANSI_CHARSET. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text_win.cc » ('j') | ui/gfx/render_text_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | ui/gfx/render_text_win.cc » ('j') | ui/gfx/render_text_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698