[evolution/gnome-3-32] M!14 - Allow floating point value for webview body font size
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-32] M!14 - Allow floating point value for webview body font size
- Date: Fri, 24 May 2019 05:48:01 +0000 (UTC)
commit 1f80815b08de3a6c72eaf59193ff6ca2c059405a
Author: Guillaume Castagnino <casta xwing info>
Date: Fri May 24 07:48:13 2019 +0200
M!14 - Allow floating point value for webview body font size
Closes https://gitlab.gnome.org/GNOME/evolution/merge_requests/14
src/e-util/e-web-view.c | 15 +++++++++++----
src/modules/webkit-editor/e-webkit-editor.c | 15 +++++++++++----
2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 5e5ea499f4..67b5ada9fc 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -3709,6 +3709,7 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
gchar *aa = NULL;
const gchar *styles[] = { "normal", "oblique", "italic" };
const gchar *smoothing = NULL;
+ gchar fsbuff[G_ASCII_DTOSTR_BUF_SIZE];
GdkColor *link = NULL;
GdkColor *visited = NULL;
GString *stylesheet;
@@ -3756,15 +3757,18 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
min_size = vw;
stylesheet = g_string_new ("");
+ g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
+ ((gdouble) pango_font_description_get_size (vw)) / PANGO_SCALE);
+
g_string_append_printf (
stylesheet,
"body {\n"
" font-family: '%s';\n"
- " font-size: %dpt;\n"
+ " font-size: %spt;\n"
" font-weight: %d;\n"
" font-style: %s;\n",
pango_font_description_get_family (vw),
- pango_font_description_get_size (vw) / PANGO_SCALE,
+ fsbuff,
pango_font_description_get_weight (vw),
styles[pango_font_description_get_style (vw)]);
@@ -3789,17 +3793,20 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
g_string_append (stylesheet, "}\n");
+ g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
+ ((gdouble) pango_font_description_get_size (ms)) / PANGO_SCALE);
+
g_string_append_printf (
stylesheet,
"pre,code,.pre {\n"
" font-family: '%s';\n"
- " font-size: %dpt;\n"
+ " font-size: %spt;\n"
" font-weight: %d;\n"
" font-style: %s;\n"
" margin: 0px;\n"
"}\n",
pango_font_description_get_family (ms),
- pango_font_description_get_size (ms) / PANGO_SCALE,
+ fsbuff,
pango_font_description_get_weight (ms),
styles[pango_font_description_get_style (ms)]);
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 9ab8734158..73ed629a0f 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -963,6 +963,7 @@ webkit_editor_update_styles (EContentEditor *editor)
gchar *font, *aa = NULL, *citation_color;
const gchar *styles[] = { "normal", "oblique", "italic" };
const gchar *smoothing = NULL;
+ gchar fsbuff[G_ASCII_DTOSTR_BUF_SIZE];
GString *stylesheet;
PangoFontDescription *min_size, *ms, *vw;
WebKitSettings *settings;
@@ -1004,16 +1005,19 @@ webkit_editor_update_styles (EContentEditor *editor)
}
stylesheet = g_string_new ("");
+ g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
+ ((gdouble) pango_font_description_get_size (vw)) / PANGO_SCALE);
+
g_string_append_printf (
stylesheet,
"body {\n"
" font-family: '%s';\n"
- " font-size: %dpt;\n"
+ " font-size: %spt;\n"
" font-weight: %d;\n"
" font-style: %s;\n"
" -webkit-line-break: after-white-space;\n",
pango_font_description_get_family (vw),
- pango_font_description_get_size (vw) / PANGO_SCALE,
+ fsbuff,
pango_font_description_get_weight (vw),
styles[pango_font_description_get_style (vw)]);
@@ -1038,16 +1042,19 @@ webkit_editor_update_styles (EContentEditor *editor)
g_string_append (stylesheet, "}\n");
+ g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
+ ((gdouble) pango_font_description_get_size (ms)) / PANGO_SCALE);
+
g_string_append_printf (
stylesheet,
"pre,code,.pre {\n"
" font-family: '%s';\n"
- " font-size: %dpt;\n"
+ " font-size: %spt;\n"
" font-weight: %d;\n"
" font-style: %s;\n"
"}",
pango_font_description_get_family (ms),
- pango_font_description_get_size (ms) / PANGO_SCALE,
+ fsbuff,
pango_font_description_get_weight (ms),
styles[pango_font_description_get_style (ms)]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]