Make nsgtk respect minimum font size setting, and save font size choices

svn path=/trunk/netsurf/; revision=2859
This commit is contained in:
Rob Kendrick 2006-08-17 19:41:14 +00:00
parent af6a2cd2e0
commit 097044996c
2 changed files with 15 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include "netsurf/render/font.h"
#include "netsurf/utils/utils.h"
#include "netsurf/utils/log.h"
#include "netsurf/desktop/options.h"
/* Until we can consider the descenders etc, we need to not render using cairo */
#undef CAIRO_VERSION
@ -256,9 +257,14 @@ PangoFontDescription *nsfont_style_to_description(
desc = pango_font_description_new();
if (style->font_size.value.length.unit == CSS_UNIT_PX)
size = style->font_size.value.length.value * PANGO_SCALE;
size = style->font_size.value.length.value;
else
size = css_len2pt(&style->font_size.value.length, style) * PANGO_SCALE;
size = css_len2pt(&style->font_size.value.length, style);
if (size < abs(option_font_min_size / 10))
size = option_font_min_size / 10;
size *= PANGO_SCALE;
switch (style->font_style) {
case CSS_FONT_STYLE_ITALIC:

View File

@ -139,6 +139,7 @@ void nsgtk_options_load(void) {
#define GET_ENTRY(x, y) if ((y)) free((y)); \
(y) = strdup(gtk_entry_get_text(GTK_ENTRY((x))))
#define GET_CHECK(x, y) (y) = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON((x)))
#define GET_SPIN(x, y) (y) = gtk_spin_button_get_value(GTK_SPIN_BUTTON((x)));
void nsgtk_options_save(void) {
GET_ENTRY(entryHomePageURL, option_homepage_url);
@ -146,6 +147,12 @@ void nsgtk_options_save(void) {
GET_CHECK(checkUseCairo, option_render_cairo);
GET_CHECK(checkResampleImages, option_render_resample);
GET_SPIN(spinDefaultSize, option_font_size);
option_font_size *= 10;
GET_SPIN(spinMinimumSize, option_font_min_size);
option_font_min_size *= 10;
/* TODO: save the other options */
options_write(options_file_location);