st/theme-node: Get resolution from context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
This commit is contained in:
parent
eaee51ff16
commit
a8496dc90f
@ -577,3 +577,17 @@ st_theme_context_get_scale_factor (StThemeContext *context)
|
||||
|
||||
return context->scale_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_theme_context_get_resolution:
|
||||
* @context: a #StThemeContext
|
||||
*
|
||||
* Returns: The font resolution
|
||||
*/
|
||||
double
|
||||
st_theme_context_get_resolution (StThemeContext *context)
|
||||
{
|
||||
g_return_val_if_fail (ST_IS_THEME_CONTEXT (context), -1);
|
||||
|
||||
return clutter_backend_get_resolution (context->clutter_backend);
|
||||
}
|
@ -63,4 +63,6 @@ StThemeNode * st_theme_context_intern_node (StThemeContext
|
||||
|
||||
int st_theme_context_get_scale_factor (StThemeContext *context);
|
||||
|
||||
double st_theme_context_get_resolution (StThemeContext *context);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1367,7 +1367,7 @@ get_length_from_term (StThemeNode *node,
|
||||
break;
|
||||
case POINTS:
|
||||
{
|
||||
double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
double resolution = st_theme_context_get_resolution (node->context);
|
||||
*length = num->val * multiplier * (resolution / 72.);
|
||||
}
|
||||
break;
|
||||
@ -1389,7 +1389,7 @@ get_length_from_term (StThemeNode *node,
|
||||
}
|
||||
else
|
||||
{
|
||||
double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
double resolution = st_theme_context_get_resolution (node->context);
|
||||
*length = num->val * multiplier * (resolution / 72.) * font_size;
|
||||
}
|
||||
}
|
||||
@ -3008,7 +3008,7 @@ font_size_from_term (StThemeNode *node,
|
||||
{
|
||||
if (term->type == TERM_IDENT)
|
||||
{
|
||||
double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
double resolution = st_theme_context_get_resolution (node->context);
|
||||
/* We work in integers to avoid double comparisons when converting back
|
||||
* from a size in pixels to a logical size.
|
||||
*/
|
||||
@ -3225,7 +3225,7 @@ st_theme_node_get_font (StThemeNode *node)
|
||||
parent_size = pango_font_description_get_size (node->font_desc);
|
||||
if (!pango_font_description_get_size_is_absolute (node->font_desc))
|
||||
{
|
||||
double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
double resolution = st_theme_context_get_resolution (node->context);
|
||||
parent_size *= (resolution / 72.);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user