[project @ 2006-01-02 23:31:28 by jmb]

Implement font default option properly

svn path=/import/netsurf/; revision=1969
This commit is contained in:
John Mark Bell 2006-01-02 23:31:29 +00:00
parent e68f319778
commit 611ec68e46
6 changed files with 10 additions and 26 deletions

View File

@ -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,

View File

@ -21,6 +21,7 @@
#include <string.h>
#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
};

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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 }, \