diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 19:18:08 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 19:18:08 +0000 |
commit | 8c26d09edaef559ea06b7a4d2ab2c3fdd197617c (patch) | |
tree | c546b4ac12f32f5206a25f0b7c6ec38f35864992 /app | |
parent | 996fd703fb7229e931203edc77df436aea9bc9a5 (diff) | |
download | chromium_src-8c26d09edaef559ea06b7a4d2ab2c3fdd197617c.zip chromium_src-8c26d09edaef559ea06b7a4d2ab2c3fdd197617c.tar.gz chromium_src-8c26d09edaef559ea06b7a4d2ab2c3fdd197617c.tar.bz2 |
Adds Font::CreateFont(PangoFontDescription* desc).
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/200019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gfx/font.h | 1 | ||||
-rw-r--r-- | app/gfx/font_gtk.cc | 24 |
2 files changed, 15 insertions, 10 deletions
diff --git a/app/gfx/font.h b/app/gfx/font.h index e0e075a..e53bd79 100644 --- a/app/gfx/font.h +++ b/app/gfx/font.h @@ -125,6 +125,7 @@ class Font { return dlus * font_ref_->height() / 8; } #elif defined(OS_LINUX) + static Font CreateFont(PangoFontDescription* desc); // We need a copy constructor and assignment operator to deal with // the Skia reference counting. Font(const Font& other); diff --git a/app/gfx/font_gtk.cc b/app/gfx/font_gtk.cc index 522c568..244810a 100644 --- a/app/gfx/font_gtk.cc +++ b/app/gfx/font_gtk.cc @@ -46,6 +46,19 @@ static std::wstring FindBestMatchFontFamilyName(const char* family_name) { return font_family; } +// static +Font Font::CreateFont(PangoFontDescription* desc) { + gint size = pango_font_description_get_size(desc); + const char* family_name = pango_font_description_get_family(desc); + + // Find best match font for |family_name| to make sure we can get + // a SkTypeface for the default font. + // TODO(agl): remove this. + std::wstring font_family = FindBestMatchFontFamilyName(family_name); + + return Font(CreateFont(font_family, size / PANGO_SCALE)); +} + // Get the default gtk system font (name and size). Font::Font() { if (default_font_ == NULL) { @@ -62,16 +75,7 @@ Font::Font() { PangoFontDescription* desc = pango_font_description_from_string(font_name); - gint size = pango_font_description_get_size(desc); - const char* family_name = pango_font_description_get_family(desc); - - // Find best match font for |family_name| to make sure we can get - // a SkTypeface for the default font. - // TODO(agl): remove this. - std::wstring font_family = FindBestMatchFontFamilyName(family_name); - - default_font_ = new Font(CreateFont(font_family, size / PANGO_SCALE)); - + default_font_ = new Font(CreateFont(desc)); pango_font_description_free(desc); g_free(font_name); |