summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/gfx/font.h1
-rw-r--r--app/gfx/font_gtk.cc24
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);