Replaced GTK3 palette font styling with CSS-compliant properties derived from PangoFontDescription, avoiding the deprecated Pango font: syntax in generated CSS.

Added a GTK3-only helper to translate Pango font fields into font-family, font-size, font-style, font-weight, font-variant, and font-stretch CSS declarations while preserving GTK2 behavior under #if !HAVE_GTK3.
Reused the GTK3 font CSS helper in the main UI font styling path to eliminate remaining Pango font: shorthand usage that triggers GTK3 theme parsing warnings.
Exposed the GTK3 font CSS helper in gtkutil so callers can emit CSS-compliant font properties consistently.
This commit is contained in:
2026-01-31 16:37:15 -07:00
parent d8a8e6ce73
commit 8abc95205a
4 changed files with 159 additions and 18 deletions

View File

@@ -124,7 +124,6 @@ mg_apply_font_css (GtkWidget *widget, const PangoFontDescription *desc,
{
GtkStyleContext *context;
GtkCssProvider *provider;
char *font_str;
GString *css;
if (!widget || !desc)
@@ -141,13 +140,13 @@ mg_apply_font_css (GtkWidget *widget, const PangoFontDescription *desc,
g_object_set_data_full (G_OBJECT (widget), provider_key, provider, g_object_unref);
}
font_str = pango_font_description_to_string (desc);
css = g_string_new (".");
g_string_append (css, class_name);
g_string_append_printf (css, " { font: %s; }", font_str);
g_string_append (css, " {");
gtkutil_append_font_css (css, desc);
g_string_append (css, " }");
gtk_css_provider_load_from_data (provider, css->str, -1, NULL);
g_string_free (css, TRUE);
g_free (font_str);
gtk_style_context_add_class (context, class_name);
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider),