I#1571 - Broken font settings can break message display
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1571
This commit is contained in:
@ -3327,7 +3327,7 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
|
||||
"monospace-font-name");
|
||||
|
||||
ms = pango_font_description_from_string (
|
||||
(font != NULL) ? font : "monospace 10");
|
||||
(font && *font) ? font : "monospace 10");
|
||||
|
||||
clean_ms = TRUE;
|
||||
|
||||
@ -3335,6 +3335,15 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
|
||||
} else
|
||||
ms = ms_font;
|
||||
|
||||
if (!pango_font_description_get_family (ms) ||
|
||||
!pango_font_description_get_size (ms)) {
|
||||
if (clean_ms)
|
||||
pango_font_description_free (ms);
|
||||
|
||||
clean_ms = TRUE;
|
||||
ms = pango_font_description_from_string ("monospace 10");
|
||||
}
|
||||
|
||||
if (!vw_font) {
|
||||
gchar *font;
|
||||
|
||||
@ -3343,7 +3352,7 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
|
||||
"font-name");
|
||||
|
||||
vw = pango_font_description_from_string (
|
||||
(font != NULL) ? font : "serif 10");
|
||||
(font && *font) ? font : "serif 10");
|
||||
|
||||
clean_vw = TRUE;
|
||||
|
||||
@ -3351,6 +3360,15 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
|
||||
} else
|
||||
vw = vw_font;
|
||||
|
||||
if (!pango_font_description_get_family (vw) ||
|
||||
!pango_font_description_get_size (vw)) {
|
||||
if (clean_vw)
|
||||
pango_font_description_free (vw);
|
||||
|
||||
clean_vw = TRUE;
|
||||
vw = pango_font_description_from_string ("serif 10");
|
||||
}
|
||||
|
||||
stylesheet = g_string_new ("");
|
||||
g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
((gdouble) pango_font_description_get_size (vw)) / PANGO_SCALE);
|
||||
|
@ -1179,25 +1179,31 @@ webkit_editor_update_styles (EContentEditor *editor)
|
||||
if (use_custom_font) {
|
||||
font = g_settings_get_string (
|
||||
wk_editor->priv->mail_settings, "monospace-font");
|
||||
ms = pango_font_description_from_string (font ? font : "monospace 10");
|
||||
ms = pango_font_description_from_string (font && *font ? font : "monospace 10");
|
||||
g_free (font);
|
||||
} else {
|
||||
font = g_settings_get_string (
|
||||
wk_editor->priv->font_settings, "monospace-font-name");
|
||||
ms = pango_font_description_from_string (font ? font : "monospace 10");
|
||||
ms = pango_font_description_from_string (font && *font ? font : "monospace 10");
|
||||
g_free (font);
|
||||
}
|
||||
|
||||
if (!pango_font_description_get_family (ms) ||
|
||||
!pango_font_description_get_size (ms)) {
|
||||
pango_font_description_free (ms);
|
||||
ms = pango_font_description_from_string ("monospace 10");
|
||||
}
|
||||
|
||||
if (wk_editor->priv->html_mode) {
|
||||
if (use_custom_font) {
|
||||
font = g_settings_get_string (
|
||||
wk_editor->priv->mail_settings, "variable-width-font");
|
||||
vw = pango_font_description_from_string (font ? font : "serif 10");
|
||||
vw = pango_font_description_from_string (font && *font ? font : "serif 10");
|
||||
g_free (font);
|
||||
} else {
|
||||
font = g_settings_get_string (
|
||||
wk_editor->priv->font_settings, "font-name");
|
||||
vw = pango_font_description_from_string (font ? font : "serif 10");
|
||||
vw = pango_font_description_from_string (font && *font ? font : "serif 10");
|
||||
g_free (font);
|
||||
}
|
||||
} else {
|
||||
@ -1205,6 +1211,12 @@ webkit_editor_update_styles (EContentEditor *editor)
|
||||
vw = pango_font_description_copy (ms);
|
||||
}
|
||||
|
||||
if (!pango_font_description_get_family (vw) ||
|
||||
!pango_font_description_get_size (vw)) {
|
||||
pango_font_description_free (vw);
|
||||
vw = pango_font_description_from_string ("serif 10");
|
||||
}
|
||||
|
||||
stylesheet = g_string_new ("");
|
||||
g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
|
||||
((gdouble) pango_font_description_get_size (vw)) / PANGO_SCALE);
|
||||
|
Reference in New Issue
Block a user