From a58d97a41a6192038573da6862571dc72a560458 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 23 May 2018 11:48:35 +0100 Subject: Plotters: Add plot_style_fixed type, and use for font size. --- content/handlers/html/box_textarea.c | 2 +- content/handlers/html/font.c | 6 +++--- content/handlers/html/form.c | 2 +- content/handlers/image/svg.c | 2 +- content/handlers/text/textplain.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'content') diff --git a/content/handlers/html/box_textarea.c b/content/handlers/html/box_textarea.c index 858de5039..c19afbb77 100644 --- a/content/handlers/html/box_textarea.c +++ b/content/handlers/html/box_textarea.c @@ -244,7 +244,7 @@ bool box_textarea_create_textarea(html_content *html, textarea_flags ta_flags; plot_font_style_t fstyle = { .family = PLOT_FONT_FAMILY_SANS_SERIF, - .size = 10 * FONT_SIZE_SCALE, + .size = 10 * PLOT_STYLE_SCALE, .weight = 400, .flags = FONTF_NONE, .background = 0, diff --git a/content/handlers/html/font.c b/content/handlers/html/font.c index 9dbf5922b..71843e108 100644 --- a/content/handlers/html/font.c +++ b/content/handlers/html/font.c @@ -147,11 +147,11 @@ void font_plot_style_from_css( css_computed_font_size(css, &length, &unit); fstyle->size = FIXTOINT(FMUL(nscss_len2pt(len_ctx, length, unit), - INTTOFIX(FONT_SIZE_SCALE))); + INTTOFIX(PLOT_STYLE_SCALE))); /* Clamp font size to configured minimum */ - if (fstyle->size < (nsoption_int(font_min_size) * FONT_SIZE_SCALE) / 10) - fstyle->size = (nsoption_int(font_min_size) * FONT_SIZE_SCALE) / 10; + if (fstyle->size < (nsoption_int(font_min_size) * PLOT_STYLE_SCALE) / 10) + fstyle->size = (nsoption_int(font_min_size) * PLOT_STYLE_SCALE) / 10; fstyle->weight = plot_font_weight(css_computed_font_weight(css)); fstyle->flags = plot_font_flags(css_computed_font_style(css), diff --git a/content/handlers/html/form.c b/content/handlers/html/form.c index 9fe2e771a..8ba99d4ab 100644 --- a/content/handlers/html/form.c +++ b/content/handlers/html/form.c @@ -1160,7 +1160,7 @@ bool form_open_select_menu(void *client_data, menu->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2), FMUL(nscss_screen_dpi, - INTTOFIX(fstyle.size / FONT_SIZE_SCALE)))), + INTTOFIX(fstyle.size / PLOT_STYLE_SCALE)))), F_72)); line_height_with_spacing = menu->line_height + diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c index 2edc7bd08..924c84879 100644 --- a/content/handlers/image/svg.c +++ b/content/handlers/image/svg.c @@ -210,7 +210,7 @@ svg_redraw_internal(struct content *c, fstyle.background = 0xffffff; fstyle.foreground = 0x000000; - fstyle.size = (8 * FONT_SIZE_SCALE) * scale; + fstyle.size = (8 * PLOT_STYLE_SCALE) * scale; res = ctx->plot->text(ctx, &fstyle, diff --git a/content/handlers/text/textplain.c b/content/handlers/text/textplain.c index e6d167bc2..af990d1d7 100644 --- a/content/handlers/text/textplain.c +++ b/content/handlers/text/textplain.c @@ -86,7 +86,7 @@ typedef struct textplain_content { #define MARGIN 4 #define TAB_WIDTH 8 /* must be power of 2 currently */ -#define TEXT_SIZE 10 * FONT_SIZE_SCALE /* Unscaled text size in pt */ +#define TEXT_SIZE 10 * PLOT_STYLE_SCALE /* Unscaled text size in pt */ static plot_font_style_t textplain_style = { .family = PLOT_FONT_FAMILY_MONOSPACE, @@ -149,7 +149,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding) parserutils_inputstream *stream; parserutils_error error; - textplain_style.size = (nsoption_int(font_size) * FONT_SIZE_SCALE) / 10; + textplain_style.size = (nsoption_int(font_size) * PLOT_STYLE_SCALE) / 10; utf8_data = malloc(CHUNK); if (utf8_data == NULL) @@ -400,7 +400,7 @@ static float textplain_line_height(void) /* Size is in points, so convert to pixels. * Then use a constant line height of 1.2 x font size. */ - return FIXTOFLT(FDIV((FMUL(FLTTOFIX(1.2), FMUL(nscss_screen_dpi, INTTOFIX((textplain_style.size / FONT_SIZE_SCALE))))), F_72)); + return FIXTOFLT(FDIV((FMUL(FLTTOFIX(1.2), FMUL(nscss_screen_dpi, INTTOFIX((textplain_style.size / PLOT_STYLE_SCALE))))), F_72)); } -- cgit v1.2.3