diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-06-06 01:24:56 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-06-06 16:01:48 +0300 |
commit | 977eea5508c3d976b0c3d591585978b092a54b53 (patch) | |
tree | e5400c774dcdcb981a0811c087edd473c2ef2f3e /libmetacity | |
parent | 1abf31270f2d9c04c4946a7e5e0dc3f961395ba9 (diff) | |
download | metacity-977eea5508c3d976b0c3d591585978b092a54b53.tar.gz |
libmetacity: apply scale in meta_theme_create_font_desc
Diffstat (limited to 'libmetacity')
-rw-r--r-- | libmetacity/meta-frame-style.c | 10 | ||||
-rw-r--r-- | libmetacity/meta-frame-style.h | 3 | ||||
-rw-r--r-- | libmetacity/meta-theme.c | 28 | ||||
-rw-r--r-- | libmetacity/meta-theme.h | 4 |
4 files changed, 29 insertions, 16 deletions
diff --git a/libmetacity/meta-frame-style.c b/libmetacity/meta-frame-style.c index 32ee34aa..6be57807 100644 --- a/libmetacity/meta-frame-style.c +++ b/libmetacity/meta-frame-style.c @@ -298,16 +298,6 @@ meta_frame_style_unref (MetaFrameStyle *style) } } -void -meta_frame_style_apply_scale (const MetaFrameStyle *style, - PangoFontDescription *font_desc) -{ - int size = pango_font_description_get_size (font_desc); - double scale = style->layout->title_scale / get_window_scaling_factor (); - - pango_font_description_set_size (font_desc, MAX (size * scale, 1)); -} - gboolean meta_frame_style_validate (MetaFrameStyle *style, guint current_theme_version, diff --git a/libmetacity/meta-frame-style.h b/libmetacity/meta-frame-style.h index 511c25ac..dc6426f9 100644 --- a/libmetacity/meta-frame-style.h +++ b/libmetacity/meta-frame-style.h @@ -96,9 +96,6 @@ void meta_frame_style_ref (MetaFrameStyle *style) void meta_frame_style_unref (MetaFrameStyle *style); -void meta_frame_style_apply_scale (const MetaFrameStyle *style, - PangoFontDescription *font_desc); - gboolean meta_frame_style_validate (MetaFrameStyle *style, guint current_theme_version, GError **error); diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c index f19ac4ca..4dc7891c 100644 --- a/libmetacity/meta-theme.c +++ b/libmetacity/meta-theme.c @@ -56,6 +56,26 @@ static GParamSpec *properties[LAST_PROP] = { NULL }; G_DEFINE_TYPE (MetaTheme, meta_theme, G_TYPE_OBJECT) +static void +font_desc_apply_scale (PangoFontDescription *font_desc, + MetaTheme *theme, + MetaFrameType type, + MetaFrameFlags flags) +{ + gint old_size; + MetaFrameStyle *style; + gdouble scale; + gint new_size; + + old_size = pango_font_description_get_size (font_desc); + style = meta_theme_get_frame_style (theme, type, flags); + scale = get_window_scaling_factor (); + + new_size = MAX (old_size * (style->layout->title_scale / scale), 1); + + pango_font_description_set_size (font_desc, new_size); +} + static MetaStyleInfo * meta_theme_get_style_info (MetaTheme *theme, const gchar *variant) @@ -358,8 +378,10 @@ meta_theme_get_frame_style (MetaTheme *theme, } PangoFontDescription* -meta_theme_create_font_desc (MetaTheme *theme, - const gchar *variant) +meta_theme_create_font_desc (MetaTheme *theme, + const gchar *variant, + MetaFrameType type, + MetaFrameFlags flags) { MetaStyleInfo *style_info; GtkStyleContext *context; @@ -379,6 +401,8 @@ meta_theme_create_font_desc (MetaTheme *theme, if (theme->titlebar_font) pango_font_description_merge (font_desc, theme->titlebar_font, TRUE); + font_desc_apply_scale (font_desc, theme, type, flags); + return font_desc; } diff --git a/libmetacity/meta-theme.h b/libmetacity/meta-theme.h index 11e1011a..64b6fc7b 100644 --- a/libmetacity/meta-theme.h +++ b/libmetacity/meta-theme.h @@ -166,7 +166,9 @@ MetaFrameStyle *meta_theme_get_frame_style (MetaTheme MetaFrameFlags flags); PangoFontDescription *meta_theme_create_font_desc (MetaTheme *theme, - const gchar *variant); + const gchar *variant, + MetaFrameType type, + MetaFrameFlags flags); gint meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc, PangoContext *context); |