provide a GUI field for alternative fonts, pango.aliases replacement
This commit is contained in:
parent
6d894ac586
commit
77ca8de9b3
|
@ -36,6 +36,9 @@
|
|||
#endif
|
||||
|
||||
#define DEF_FONT "Monospace 9"
|
||||
#ifdef WIN32
|
||||
#define DEF_FONT_ALTER "Arial Unicode MS,Lucida Sans Unicode"
|
||||
#endif
|
||||
|
||||
void
|
||||
list_addentry (GSList ** list, char *cmd, char *name)
|
||||
|
@ -578,6 +581,10 @@ const struct prefs vars[] = {
|
|||
{"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL},
|
||||
#endif
|
||||
{"text_font", P_OFFSET (font_normal), TYPE_STR},
|
||||
#ifdef WIN32
|
||||
{"text_font_main", P_OFFSET (font_main), TYPE_STR},
|
||||
{"text_font_alternative", P_OFFSET (font_alternative), TYPE_STR},
|
||||
#endif
|
||||
{"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL},
|
||||
{"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT},
|
||||
{"text_max_lines", P_OFFINT (max_lines), TYPE_INT},
|
||||
|
@ -749,6 +756,10 @@ load_config (void)
|
|||
strcpy (prefs.quitreason, _("Leaving"));
|
||||
strcpy (prefs.partreason, prefs.quitreason);
|
||||
strcpy (prefs.font_normal, DEF_FONT);
|
||||
#ifdef WIN32
|
||||
strcpy (prefs.font_main, DEF_FONT);
|
||||
strcpy (prefs.font_alternative, DEF_FONT_ALTER);
|
||||
#endif
|
||||
strcpy (prefs.dnsprogram, "host");
|
||||
strcpy (prefs.irc_no_hilight, "NickServ,ChanServ");
|
||||
|
||||
|
|
|
@ -115,7 +115,13 @@ struct xchatprefs
|
|||
char awayreason[256];
|
||||
char quitreason[256];
|
||||
char partreason[256];
|
||||
#ifdef WIN32
|
||||
char font_normal[4 * FONTNAMELEN + 1];
|
||||
char font_main[FONTNAMELEN + 1];
|
||||
char font_alternative[3 * FONTNAMELEN + 1];
|
||||
#else
|
||||
char font_normal[FONTNAMELEN + 1];
|
||||
#endif
|
||||
char doubleclickuser[256];
|
||||
char gui_license[64];
|
||||
char spell_langs[64];
|
||||
|
|
|
@ -102,7 +102,12 @@ typedef struct
|
|||
static const setting textbox_settings[] =
|
||||
{
|
||||
{ST_HEADER, N_("Text Box Appearance"),0,0,0},
|
||||
#ifdef WIN32
|
||||
{ST_EFONT, N_("Main font:"), P_OFFSETNL(font_main), 0, 0, sizeof prefs.font_main},
|
||||
{ST_ENTRY, N_("Alternative fonts:"), P_OFFSETNL(font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.font_alternative},
|
||||
#else
|
||||
{ST_EFONT, N_("Font:"), P_OFFSETNL(font_normal), 0, 0, sizeof prefs.font_normal},
|
||||
#endif
|
||||
{ST_EFILE, N_("Background image:"), P_OFFSETNL(background), 0, 0, sizeof prefs.background},
|
||||
{ST_NUMBER, N_("Scrollback lines:"), P_OFFINTNL(max_lines),0,0,100000},
|
||||
{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(colorednicks),
|
||||
|
@ -2056,6 +2061,11 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout)
|
|||
static void
|
||||
setup_apply (struct xchatprefs *pr)
|
||||
{
|
||||
#ifdef WIN32
|
||||
PangoFontDescription *old_desc;
|
||||
PangoFontDescription *new_desc;
|
||||
char buffer[4 * FONTNAMELEN + 1];
|
||||
#endif
|
||||
int new_pix = FALSE;
|
||||
int noapply = FALSE;
|
||||
int do_ulist = FALSE;
|
||||
|
@ -2099,6 +2109,19 @@ setup_apply (struct xchatprefs *pr)
|
|||
|
||||
memcpy (&prefs, pr, sizeof (prefs));
|
||||
|
||||
#ifdef WIN32 /* merge font_main and font_alternative into font_normal */
|
||||
old_desc = pango_font_description_from_string (prefs.font_main);
|
||||
sprintf (buffer, "%s,%s", pango_font_description_get_family (old_desc), prefs.font_alternative);
|
||||
new_desc = pango_font_description_from_string (buffer);
|
||||
pango_font_description_set_weight (new_desc, pango_font_description_get_weight (old_desc));
|
||||
pango_font_description_set_style (new_desc, pango_font_description_get_style (old_desc));
|
||||
pango_font_description_set_size (new_desc, pango_font_description_get_size (old_desc));
|
||||
sprintf (prefs.font_normal, "%s", pango_font_description_to_string (new_desc));
|
||||
|
||||
g_free (old_desc);
|
||||
g_free (new_desc);
|
||||
#endif
|
||||
|
||||
setup_apply_real (new_pix, do_ulist, do_layout);
|
||||
|
||||
if (noapply)
|
||||
|
|
Loading…
Reference in New Issue