From 391bbbee851c7e90e28322cf48a9277cc7aab883 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 9 Sep 2003 20:16:23 +0000 Subject: First important step in solving the fonts mess. Allow to select the 2003-09-09 Marco Pesenti Gritti * data/default-prefs.js: * data/glade/prefs-dialog.glade: * embed/ephy-embed-single.c: (ephy_embed_single_get_font_list): * embed/ephy-embed-single.h: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-notifiers.cpp: * src/prefs-dialog.c: (setup_font_menu), (attach_fonts_signals), (setup_size_controls), (setup_fonts), (prefs_dialog_init): First important step in solving the fonts mess. Allow to select the variable width instead of families. Also use points instead of pixels. Set a minimum font size by default. --- ChangeLog | 16 + data/default-prefs.js | 3 + data/glade/prefs-dialog.glade | 633 ++++++++++++--------------------- embed/ephy-embed-single.c | 7 +- embed/ephy-embed-single.h | 8 +- embed/mozilla/mozilla-embed-single.cpp | 13 +- embed/mozilla/mozilla-notifiers.cpp | 2 +- src/prefs-dialog.c | 56 ++- 8 files changed, 265 insertions(+), 473 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5186b0df7..2469e633a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2003-09-09 Marco Pesenti Gritti + + * data/default-prefs.js: + * data/glade/prefs-dialog.glade: + * embed/ephy-embed-single.c: (ephy_embed_single_get_font_list): + * embed/ephy-embed-single.h: + * embed/mozilla/mozilla-embed-single.cpp: + * embed/mozilla/mozilla-notifiers.cpp: + * src/prefs-dialog.c: (setup_font_menu), (attach_fonts_signals), + (setup_size_controls), (setup_fonts), (prefs_dialog_init): + + First important step in solving the fonts mess. + Allow to select the variable width instead of + families. Also use points instead of pixels. + Set a minimum font size by default. + 2003-09-09 Christian Persch * lib/widgets/Makefile.am: diff --git a/data/default-prefs.js b/data/default-prefs.js index ceba11b0f..e225055a1 100644 --- a/data/default-prefs.js +++ b/data/default-prefs.js @@ -36,3 +36,6 @@ pref("keyword.enabled", true); pref("security.warn_entering_secure", false); pref("security.warn_leaving_secure", false); pref("security.warn_submit_insecure", false); + +// fonts +pref("font.size.unit", "pt"); diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade index 44e0e5498..ec6224ce2 100644 --- a/data/glade/prefs-dialog.glade +++ b/data/glade/prefs-dialog.glade @@ -495,319 +495,199 @@ - + True - 7 - 4 False - 6 - 12 + 18 - + True - Siz_e: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - fixed_size_spinbutton - - - 2 - 3 - 4 - 5 - fill - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 0 100 1 10 10 - - - 3 - 4 - 4 - 5 - - - - - - - - True - Si_ze: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - variable_size_spinbutton - - - 2 - 3 - 1 - 2 - fill - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 100 1 10 10 - - - 3 - 4 - 1 - 2 - fill - - - - - - - True - _Proportional: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - proportional_optionmenu - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - _Serif: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - combo-entry1 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - S_ans serif: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - combo-entry2 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - _Monospace: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - combo-entry5 - - - 0 - 1 - 4 - 5 - fill - - - - - - - True - _Language: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - fonts_language_optionmenu - - - 0 - 1 - 0 - 1 - fill - - - + 4 + 3 + False + 6 + 12 - - - True - True - -1 + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 + + + 2 + 3 + 2 + 3 + + + + - - + + True + _Variable width: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + combo-entry1 + + 0 + 1 + 1 + 2 + fill + + - - - 1 - 2 - 0 - 1 - fill - - - - - - True - True - 0 + + + True + _Fixed width: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + combo-entry5 + + + 0 + 1 + 2 + 3 + fill + + + - + + True + For _Language: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + fonts_language_optionmenu + + + 0 + 1 + 0 + 1 + fill + + + - - + + + True + False + True + False + True + False + + + True - Serif - True + True + False + True + 0 + + True + * + False - - + + True - Sans Serif - True + GTK_SELECTION_BROWSE + + 1 + 2 + 1 + 2 + + - - - 1 - 2 - 1 - 2 - - - - - - - True - False - 12 - + True - True - Always use _these fonts - True - GTK_RELIEF_NORMAL - False - False - True + False + True + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + - 0 - True - True + 1 + 2 + 2 + 3 + True - Min_imum font size: + Min_imum size: True False GTK_JUSTIFY_LEFT @@ -820,14 +700,17 @@ min_size_spinbutton - 0 - False - False + 0 + 1 + 3 + 4 + fill + - + True True 1 @@ -839,159 +722,81 @@ 0 0 100 1 10 10 - 0 - False - True + 2 + 3 + 1 + 2 + + - - - 0 - 4 - 6 - 7 - fill - - - - - True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 1 - 2 - 2 - 3 - - - - - - - True - False - True - False - True - False - - - + + True True - False - True - 0 - - True - * - False - - + -1 - - - True - GTK_SELECTION_BROWSE + + + True + + + + 1 + 3 + 0 + 1 + fill + + - - - 1 - 2 - 3 - 4 - - - - - - True - False - True - False - True - False - - - + + True True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 0 0 100 1 10 10 + + 2 + 3 + 3 + 4 + + + - 1 - 2 - 4 - 5 - + 0 + True + True - + True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 + True + Always use _these fonts + True + GTK_RELIEF_NORMAL + False + False + True - 0 - 1 - 5 - 6 - fill - + 0 + False + False diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c index fe42ba07b..83c60026a 100644 --- a/embed/ephy-embed-single.c +++ b/embed/ephy-embed-single.c @@ -159,13 +159,10 @@ ephy_embed_single_get_language_groups (EphyEmbedSingle *shell, gresult ephy_embed_single_get_font_list (EphyEmbedSingle *shell, const char *langGroup, - const char *fontType, - GList **fontList, - char **default_font) + GList **fontList) { EphyEmbedSingleClass *klass = EPHY_EMBED_SINGLE_GET_CLASS (shell); - return klass->get_font_list (shell, langGroup, fontType, fontList, - default_font); + return klass->get_font_list (shell, langGroup, fontList); } gresult diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h index 2ca30f41b..4ef689d3f 100644 --- a/embed/ephy-embed-single.h +++ b/embed/ephy-embed-single.h @@ -127,9 +127,7 @@ struct EphyEmbedSingleClass GList **encodings); gresult (* get_font_list) (EphyEmbedSingle *shell, const char *langGroup, - const char *fontType, - GList **fontList, - char **default_font); + GList **fontList); gresult (* list_cookies) (EphyEmbedSingle *shell, GList **cokies); gresult (* remove_cookies) (EphyEmbedSingle *shell, @@ -172,9 +170,7 @@ gresult ephy_embed_single_get_encodings (EphyEmbedSingle *shell, gresult ephy_embed_single_get_font_list (EphyEmbedSingle *shell, const char *langGroup, - const char *fontType, - GList **fontList, - char **default_font); + GList **fontList); /* Cookies */ gresult ephy_embed_single_list_cookies (EphyEmbedSingle *shell, diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index a850fecd0..4cee89bd5 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -214,9 +214,7 @@ impl_get_language_groups (EphyEmbedSingle *shell, static gresult impl_get_font_list (EphyEmbedSingle *shell, const char *langGroup, - const char *fontType, - GList **fontList, - char **default_font); + GList **fontList); static gresult impl_list_cookies (EphyEmbedSingle *shell, GList **cookies); @@ -811,9 +809,7 @@ impl_get_language_groups (EphyEmbedSingle *shell, static gresult impl_get_font_list (EphyEmbedSingle *shell, const char *langGroup, - const char *fontType, - GList **fontList, - char **default_font) + GList **fontList) { nsresult rv; PRUint32 fontCount; @@ -841,11 +837,6 @@ impl_get_font_list (EphyEmbedSingle *shell, *fontList = g_list_reverse (l); - if (default_font != NULL) - { - *default_font = g_strdup (fontType); - } - return G_OK; } diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index 6c46fe55e..0b5867921 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -440,7 +440,7 @@ mozilla_notifiers_init(EphyEmbedSingle *single) for (i = 0; i < n_fonts_languages; i++) { guint k; - char *types [] = { "serif", "sans-serif", "cursive", "fantasy", "monospace" }; + char *types [] = { "variable", "monospace" }; char key[255]; char *info; diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 6f0b05e97..b99b75de4 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -175,25 +175,16 @@ char *cookies_accept_enum [] = }; static guint n_cookies_accept_enum = G_N_ELEMENTS (cookies_accept_enum); -static const -char *proportional_enum [] = -{ - "serif", "sans-serif" -}; -static guint n_proportional_enum = G_N_ELEMENTS (proportional_enum); - enum { - FONT_TYPE_SERIF, - FONT_TYPE_SANSSERIF, + FONT_TYPE_VARIABLE, FONT_TYPE_MONOSPACE }; const char *fonts_types[] = { - "serif", - "sans-serif", + "variable", "monospace" }; @@ -223,13 +214,11 @@ enum /* Fonts and Colors */ FONTS_LANGUAGE_PROP, - SERIF_PROP, - SANSSERIF_PROP, + VARIABLE_PROP, MONOSPACE_PROP, FIXED_SIZE_PROP, VARIABLE_SIZE_PROP, MIN_SIZE_PROP, - PROPORTIONAL_PROP, USE_COLORS_PROP, USE_FONTS_PROP, @@ -263,13 +252,11 @@ EphyDialogProperty properties [] = /* Fonts and Colors */ { FONTS_LANGUAGE_PROP, "fonts_language_optionmenu", CONF_FONTS_FOR_LANGUAGE, PT_AUTOAPPLY, NULL }, - { SERIF_PROP, "serif_combo", NULL, PT_NORMAL, NULL }, - { SANSSERIF_PROP, "sansserif_combo", NULL, PT_NORMAL, NULL }, + { VARIABLE_PROP, "variable_combo", NULL, PT_NORMAL, NULL }, { MONOSPACE_PROP, "monospace_combo", NULL, PT_NORMAL, NULL }, { FIXED_SIZE_PROP, "fixed_size_spinbutton", NULL, PT_NORMAL, NULL }, { VARIABLE_SIZE_PROP, "variable_size_spinbutton", NULL, PT_NORMAL, NULL }, { MIN_SIZE_PROP, "min_size_spinbutton", NULL, PT_NORMAL, NULL }, - { PROPORTIONAL_PROP, "proportional_optionmenu", CONF_RENDERING_DEFAULT_FONT, PT_AUTOAPPLY, NULL }, { USE_COLORS_PROP, "use_colors_checkbutton", CONF_RENDERING_USE_OWN_COLORS, PT_AUTOAPPLY, NULL }, { USE_FONTS_PROP, "use_fonts_checkbutton", CONF_RENDERING_USE_OWN_FONTS, PT_AUTOAPPLY, NULL }, @@ -447,7 +434,6 @@ setup_font_menu (PrefsDialog *dialog, const char *type, GtkWidget *combo) { - char *default_font; GList *fonts = NULL; gchar *name; char key[255]; @@ -459,7 +445,7 @@ setup_font_menu (PrefsDialog *dialog, ephy_embed_single_get_font_list (single, get_current_language_code (dialog), - type, &fonts, &default_font); + &fonts); /* Get the default font */ g_snprintf (key, 255, "%s_%s_%s", CONF_RENDERING_FONT, type, @@ -467,7 +453,14 @@ setup_font_menu (PrefsDialog *dialog, name = eel_gconf_get_string (key); if (name == NULL) { - name = g_strdup (default_font); + if (strcmp (type, "variable") == 0) + { + name = g_strdup ("sans-serif"); + } + else + { + name = g_strdup ("monospace"); + } } /* set popdown doesnt like NULL */ @@ -489,7 +482,6 @@ setup_font_menu (PrefsDialog *dialog, &pos); } - g_free (default_font); g_free (name); g_list_foreach (fonts, (GFunc)g_free, NULL); @@ -551,10 +543,8 @@ attach_font_signal (PrefsDialog *dialog, int prop, static void attach_fonts_signals (PrefsDialog *dialog) { - attach_font_signal (dialog, SERIF_PROP, - GINT_TO_POINTER(FONT_TYPE_SERIF)); - attach_font_signal (dialog, SANSSERIF_PROP, - GINT_TO_POINTER(FONT_TYPE_SANSSERIF)); + attach_font_signal (dialog, VARIABLE_PROP, + GINT_TO_POINTER(FONT_TYPE_VARIABLE)); attach_font_signal (dialog, MONOSPACE_PROP, GINT_TO_POINTER(FONT_TYPE_MONOSPACE)); } @@ -630,15 +620,15 @@ setup_size_controls (PrefsDialog *dialog) spin = ephy_dialog_get_control (EPHY_DIALOG(dialog), FIXED_SIZE_PROP); - setup_size_control (dialog, CONF_RENDERING_FONT_FIXED_SIZE, 12, spin); + setup_size_control (dialog, CONF_RENDERING_FONT_FIXED_SIZE, 10, spin); spin = ephy_dialog_get_control (EPHY_DIALOG(dialog), VARIABLE_SIZE_PROP); - setup_size_control (dialog, CONF_RENDERING_FONT_VAR_SIZE, 16, spin); + setup_size_control (dialog, CONF_RENDERING_FONT_VAR_SIZE, 12, spin); spin = ephy_dialog_get_control (EPHY_DIALOG(dialog), MIN_SIZE_PROP); - setup_size_control (dialog, CONF_RENDERING_FONT_MIN_SIZE, 0, spin); + setup_size_control (dialog, CONF_RENDERING_FONT_MIN_SIZE, 7, spin); } static gint @@ -655,12 +645,8 @@ setup_fonts (PrefsDialog *dialog) dialog->priv->switching = TRUE; combo = ephy_dialog_get_control (EPHY_DIALOG(dialog), - SERIF_PROP); - setup_font_menu (dialog, "serif", combo); - - combo = ephy_dialog_get_control (EPHY_DIALOG(dialog), - SANSSERIF_PROP); - setup_font_menu (dialog, "sans-serif", combo); + VARIABLE_PROP); + setup_font_menu (dialog, "variable", combo); combo = ephy_dialog_get_control (EPHY_DIALOG(dialog), MONOSPACE_PROP); @@ -1088,8 +1074,6 @@ prefs_dialog_init (PrefsDialog *pd) ephy_dialog_add_enum (EPHY_DIALOG (pd), ACCEPT_COOKIES_PROP, n_cookies_accept_enum, cookies_accept_enum); - ephy_dialog_add_enum (EPHY_DIALOG (pd), PROPORTIONAL_PROP, - n_proportional_enum, proportional_enum); ephy_dialog_set_size_group (EPHY_DIALOG (pd), lang_size_group, n_lang_size_group); -- cgit v1.2.3