summaryrefslogtreecommitdiffstats
path: root/ui/gfx/platform_font_win.h
diff options
context:
space:
mode:
authoryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 10:52:24 +0000
committeryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 10:52:24 +0000
commitc831ea9cacd4711fb3e7ff56e8c4ca30fafb1ed3 (patch)
treee3a3e0de8e7e46afad5e6b422b1d315dc589de96 /ui/gfx/platform_font_win.h
parentf0991b4bde7420e2cb95b4f160f20f9f55facd1b (diff)
downloadchromium_src-c831ea9cacd4711fb3e7ff56e8c4ca30fafb1ed3.zip
chromium_src-c831ea9cacd4711fb3e7ff56e8c4ca30fafb1ed3.tar.gz
chromium_src-c831ea9cacd4711fb3e7ff56e8c4ca30fafb1ed3.tar.bz2
Supports cap height in gfx::Font and gfx::FontList.
This CL is a preparation of http://crrev.com/23601006 . Cap height will be used to determine the fixed baseline of text, especially for Omnibox but not limited to. Omnibox wants to show Latin characters vertically center, i.e. ABC look just center. Omnibox also wants to resize the font list so text is small enough to fit in Omnibox. The baseline is determined from these two restrictions. All the texts are rendered based on this baseline regardless its height. Any characters within the height of the font list must fit in Omnibox. For text controls other than Omnibox, the height of text box may be determined from the height of the font list and the cap height may not be used. If the height of text box is smaller than the height of the font list, then the text control determines the baseline based on cap height so it shows ABC vertically center. BUG=146236,264436 TEST=Ran ui_unittests. Review URL: https://codereview.chromium.org/24240013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/platform_font_win.h')
-rw-r--r--ui/gfx/platform_font_win.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h
index 77f3658..035ce8a 100644
--- a/ui/gfx/platform_font_win.h
+++ b/ui/gfx/platform_font_win.h
@@ -57,6 +57,7 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
virtual Font DeriveFont(int size_delta, int style) const OVERRIDE;
virtual int GetHeight() const OVERRIDE;
virtual int GetBaseline() const OVERRIDE;
+ virtual int GetCapHeight() const OVERRIDE;
virtual int GetAverageCharacterWidth() const OVERRIDE;
virtual int GetStringWidth(const base::string16& text) const OVERRIDE;
virtual int GetExpectedTextWidth(int length) const OVERRIDE;
@@ -84,6 +85,7 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
int font_size,
int height,
int baseline,
+ int cap_height,
int ave_char_width,
int style);
@@ -91,6 +93,7 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
HFONT hfont() const { return hfont_; }
int height() const { return height_; }
int baseline() const { return baseline_; }
+ int cap_height() const { return cap_height_; }
int ave_char_width() const { return ave_char_width_; }
int style() const { return style_; }
const std::string& font_name() const { return font_name_; }
@@ -109,6 +112,7 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
const int font_size_;
const int height_;
const int baseline_;
+ const int cap_height_;
const int ave_char_width_;
const int style_;
// Average character width in dialog units. This is queried lazily from the
@@ -155,4 +159,3 @@ class GFX_EXPORT PlatformFontWin : public PlatformFont {
} // namespace gfx
#endif // UI_GFX_PLATFORM_FONT_WIN_H_
-