diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 23:24:39 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 23:24:39 +0000 |
commit | 8129fa5c5831b56fe73e15ebd6cf42fd3a7c935c (patch) | |
tree | 228ee2811357227d23fb3c62502f5b05269bfa08 /app/gfx/font.h | |
parent | d87703cb9b1debdbe2704f7f50a2f33d38457b37 (diff) | |
download | chromium_src-8129fa5c5831b56fe73e15ebd6cf42fd3a7c935c.zip chromium_src-8129fa5c5831b56fe73e15ebd6cf42fd3a7c935c.tar.gz chromium_src-8129fa5c5831b56fe73e15ebd6cf42fd3a7c935c.tar.bz2 |
Got the about panel to have its text lined up correctly.
Also added underline capability to linux fonts.
Review URL: http://codereview.chromium.org/338029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx/font.h')
-rw-r--r-- | app/gfx/font.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/gfx/font.h b/app/gfx/font.h index bc8ee92..4bea194 100644 --- a/app/gfx/font.h +++ b/app/gfx/font.h @@ -136,6 +136,13 @@ class Font { // Converts |gfx_font| to a new pango font. Free the returned font with // pango_font_description_free(). static PangoFontDescription* PangoFontFromGfxFont(const gfx::Font& gfx_font); + + // Position as an offset from the height of the drawn text, used to draw + // an underline. This is a negative number, so the underline would be + // drawn at y + height + underline_position; + double underline_position() const; + // The thickness to draw the underline. + double underline_thickness() const; #endif private: @@ -207,7 +214,10 @@ class Font { static Font* default_font_; // The average width of a character, initialized and cached if needed. - double avg_width(); + double avg_width() const; + + // Potentially slow call to get pango metrics (avg width, underline info). + void InitPangoMetrics(); // These two both point to the same SkTypeface. We use the SkAutoUnref to // handle the reference counting, but without @typeface_ we would have to @@ -224,7 +234,13 @@ class Font { // Cached metrics, generated at construction int height_; int ascent_; + + // The pango metrics are much more expensive so we wait until we need them + // to compute them. + bool pango_metrics_inited_; double avg_width_; + double underline_position_; + double underline_thickness_; #elif defined(OS_MACOSX) explicit Font(const std::wstring& font_name, int font_size, int style); |