From a2cf67e5986cdbdba24eb2b4ee0ef7be810e7cc7 Mon Sep 17 00:00:00 2001 From: "hbono@chromium.org" <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 30 Oct 2008 16:22:56 +0000 Subject: Fix Issue 2918 in chromium: Chrome dialog displayed in large size with Meiryo font.This issue is caused by a font whose text metric |tmAveCharWidth| is not precise as noted in Microsoft Knowledge Base 145994 (*1) To handle this case, this change uses the ChromeFont::horizontal_dlus_to_pixels() function instead of the ChromeFont::ave_char_width() function.(*1) http://support.microsoft.com/kb/145994BUG=2918 Review URL: http://codereview.chromium.org/8051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4213 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/gfx/chrome_font.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'chrome/common/gfx') diff --git a/chrome/common/gfx/chrome_font.h b/chrome/common/gfx/chrome_font.h index 77e48f6..2cfd28b 100644 --- a/chrome/common/gfx/chrome_font.h +++ b/chrome/common/gfx/chrome_font.h @@ -65,6 +65,13 @@ class ChromeFont { // string. int GetStringWidth(const std::wstring& text) const; + // Returns the expected number of horizontal pixels needed to display + // the specified length of characters. + // Call the GetStringWidth() function to retrieve the actual number. + int GetExpectedTextWidth(int length) const { + return length * font_ref_->dlu_base_x(); + } + // Returns the style of the font. int style() const { return font_ref_->style(); } -- cgit v1.1