diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 04:52:54 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 04:52:54 +0000 |
commit | 4cbb9470af9aa354128cb6dda5146bae0eaeeb8a (patch) | |
tree | d9db783a2772e5131ebfc30b7edf0187adcfceda | |
parent | 2226eb1ef4b32cf154205505c4b5bc40327b6efe (diff) | |
download | chromium_src-4cbb9470af9aa354128cb6dda5146bae0eaeeb8a.zip chromium_src-4cbb9470af9aa354128cb6dda5146bae0eaeeb8a.tar.gz chromium_src-4cbb9470af9aa354128cb6dda5146bae0eaeeb8a.tar.bz2 |
A fix for Issue 4400 (or maybe 4222).
Sorry for my slow change. I noticed we should use the DLU size to calculate the expected text width only when it is smaller than average character width, i.e. ave_char_width(). (The DLU size becomes smaller than the average character width only when a font contains lots of CJK characters because most of CJK characters are much wider than alphabets.) So, this change uses the DLU size only when it is smaller than the average character width. I wish this makes you happy.
Also, this change replaces TAB characters with spaces.
Review URL: http://codereview.chromium.org/28181
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10586 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/gfx/chrome_font_win.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chrome/common/gfx/chrome_font_win.cc b/chrome/common/gfx/chrome_font_win.cc index d297e23..6fcadc0 100644 --- a/chrome/common/gfx/chrome_font_win.cc +++ b/chrome/common/gfx/chrome_font_win.cc @@ -43,7 +43,7 @@ int ChromeFont::ave_char_width() const { } int ChromeFont::GetExpectedTextWidth(int length) const { - return length * font_ref_->dlu_base_x(); + return length * std::min(font_ref_->dlu_base_x(), ave_char_width()); } int ChromeFont::style() const { @@ -75,7 +75,7 @@ ChromeFont ChromeFont::CreateFont(const std::wstring& font_name, // static ChromeFont::HFontRef* ChromeFont::GetBaseFontRef() { if (base_font_ref_ == NULL) { - NONCLIENTMETRICS metrics; + NONCLIENTMETRICS metrics; win_util::GetNonClientMetrics(&metrics); // See comment in ChromeFont::DeriveFont() about font size. |