diff --git a/css/css.c b/css/css.c index 2b4ad4d24..d5083a30f 100644 --- a/css/css.c +++ b/css/css.c @@ -155,7 +155,7 @@ const struct css_style css_base_style = { CSS_DISPLAY_BLOCK, CSS_EMPTY_CELLS_SHOW, CSS_FLOAT_NONE, - CSS_FONT_FAMILY_INHERIT, /* Default font is user-defined */ + CSS_FONT_FAMILY_SANS_SERIF, { CSS_FONT_SIZE_LENGTH, { { 10, CSS_UNIT_PT } } }, CSS_FONT_STYLE_NORMAL, CSS_FONT_VARIANT_NORMAL, diff --git a/desktop/options.c b/desktop/options.c index ad8f17042..2310b3a27 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -21,6 +21,7 @@ #include #include "libxml/HTMLparser.h" #include "libxml/HTMLtree.h" +#include "netsurf/css/css.h" #include "netsurf/desktop/options.h" #include "netsurf/desktop/tree.h" #include "netsurf/utils/log.h" @@ -67,6 +68,8 @@ bool option_send_referer = true; bool option_animate_images = true; /** How many days to retain URL data for */ int option_expire_url = 28; +/** Default font family */ +int option_font_default = CSS_FONT_FAMILY_SANS_SERIF; EXTRA_OPTION_DEFINE @@ -91,7 +94,8 @@ struct { { "minimum_gif_delay", OPTION_INTEGER, &option_minimum_gif_delay }, { "send_referer", OPTION_BOOL, &option_send_referer }, { "animate_images", OPTION_BOOL, &option_animate_images }, - { "expire_url", OPTION_INTEGER, &option_expire_url }, \ + { "expire_url", OPTION_INTEGER, &option_expire_url }, + { "font_default", OPTION_INTEGER, &option_font_default }, EXTRA_OPTION_TABLE }; diff --git a/desktop/options.h b/desktop/options.h index ee9c48415..ffd8fb83f 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -45,6 +45,7 @@ extern int option_minimum_gif_delay; extern bool option_send_referer; extern bool option_animate_images; extern int option_expire_url; +extern int option_font_default; /* a css_font_family */ void options_read(const char *path); void options_write(const char *path); diff --git a/render/box_construct.c b/render/box_construct.c index a66208a74..795caf8f0 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -177,6 +177,8 @@ bool xml_to_box(xmlNode *n, struct content *c) return false; c->data.html.style->font_size.value.length.value = option_font_size * 0.1; + /* and get the default font family from the options */ + c->data.html.style->font_family = option_font_default; c->data.html.object_count = 0; c->data.html.object = 0; diff --git a/riscos/font.c b/riscos/font.c index 622f713c2..4bbfcc8b0 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -452,26 +452,7 @@ void nsfont_read_style(const struct css_style *style, *font_family = option_font_fantasy; break; default: - switch (option_font_default) { - case CSS_FONT_FAMILY_SANS_SERIF: - *font_family = option_font_sans; - break; - case CSS_FONT_FAMILY_SERIF: - *font_family = option_font_serif; - break; - case CSS_FONT_FAMILY_MONOSPACE: - *font_family = option_font_mono; - break; - case CSS_FONT_FAMILY_CURSIVE: - *font_family = option_font_cursive; - break; - case CSS_FONT_FAMILY_FANTASY: - *font_family = option_font_fantasy; - break; - default: - *font_family = option_font_sans; - break; - } + *font_family = option_font_sans; break; } diff --git a/riscos/options.h b/riscos/options.h index 4d55e0da9..1c153c088 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -14,7 +14,6 @@ #ifndef _NETSURF_RISCOS_OPTIONS_H_ #define _NETSURF_RISCOS_OPTIONS_H_ -#include "netsurf/css/css.h" #include "netsurf/desktop/options.h" #include "netsurf/riscos/tinct.h" @@ -53,7 +52,6 @@ extern char *option_font_serif; extern char *option_font_mono; extern char *option_font_cursive; extern char *option_font_fantasy; -extern int option_font_default; /* a css_font_family */ extern bool option_block_popups; extern bool option_url_suggestion; extern int option_image_memory_direct; /* -1 means auto-detect */ @@ -96,7 +94,6 @@ char *option_font_serif = 0; \ char *option_font_mono = 0; \ char *option_font_cursive = 0; \ char *option_font_fantasy = 0; \ -int option_font_default = CSS_FONT_FAMILY_SANS_SERIF; \ bool option_block_popups = false; \ bool option_url_suggestion = true; \ int option_image_memory_direct = -1; \ @@ -139,7 +136,6 @@ bool option_strip_extensions = true; { "font_mono", OPTION_STRING, &option_font_mono }, \ { "font_cursive", OPTION_STRING, &option_font_cursive }, \ { "font_fantasy", OPTION_STRING, &option_font_fantasy }, \ -{ "font_default", OPTION_INTEGER, &option_font_default }, \ { "block_popups", OPTION_BOOL, &option_block_popups }, \ { "url_suggestion", OPTION_BOOL, &option_url_suggestion }, \ { "image_memory_direct", OPTION_INTEGER, &option_image_memory_direct }, \