From: pcg Date: Sun, 22 Feb 2004 08:28:36 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=2c0617c78f64964e8e8afa8479cee3efb1d04a9d;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/command.C b/src/command.C index 92c33274..4e0f9ff1 100644 --- a/src/command.C +++ b/src/command.C @@ -143,12 +143,12 @@ rxvt_term::lookup_key (XKeyEvent &ev) { if (keysym == ks_bigfont) { - change_font (0, FONT_UP); + change_font (FONT_UP); return; } else if (keysym == ks_smallfont) { - change_font (0, FONT_DN); + change_font (FONT_DN); return; } } @@ -231,10 +231,10 @@ rxvt_term::lookup_key (XKeyEvent &ev) return; /* rxvt extras */ case XK_KP_Add: /* Shift+KP_Add = bigger font */ - change_font (0, FONT_UP); + change_font (FONT_UP); return; case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ - change_font (0, FONT_DN); + change_font (FONT_DN); return; } } @@ -2973,6 +2973,7 @@ rxvt_term::process_osc_seq () * 50 = change font * * rxvt extensions: + * 9 = change locale (NYI) * 10 = menu (may change in future) * 20 = bg pixmap * 39 = change default fg color @@ -3073,7 +3074,10 @@ rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ case XTerm_logfile: break; case XTerm_font: - change_font (0, str); + change_font (str); + break; + case XTerm_locale: + /* TODO */ break; #if 0 case XTerm_dumpscreen: /* no error notices */ diff --git a/src/defaultfont.C b/src/defaultfont.C index 736d4a0c..d72d9cf3 100644 --- a/src/defaultfont.C +++ b/src/defaultfont.C @@ -1069,7 +1069,7 @@ rxvt_fontset::realize_font (int i) return true; } -void +bool rxvt_fontset::populate (const char *desc) { clear (); @@ -1091,12 +1091,11 @@ rxvt_fontset::populate (const char *desc) } if ((int)fonts.size () <= base_id || !realize_font (base_id)) - { - fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); - exit (1); - } + return false; base_prop = fonts[base_id]->properties (); + + return true; } int diff --git a/src/defaultfont.h b/src/defaultfont.h index c6e917ac..3b9a6380 100644 --- a/src/defaultfont.h +++ b/src/defaultfont.h @@ -75,7 +75,7 @@ struct rxvt_fontset { rxvt_font *new_font (const char *name, codeset cs); - void populate (const char *desc); + bool populate (const char *desc); int find_font (uint32_t unicode); rxvt_font *operator [] (int id) const diff --git a/src/init.C b/src/init.C index 7f292617..914a357b 100644 --- a/src/init.C +++ b/src/init.C @@ -666,12 +666,6 @@ rxvt_term::init_resources (int argc, const char *const *argv) rs[Rs_scrollBar_thickness]); #endif - TermWin.fontset = new rxvt_fontset (this); - TermWin.fontset->populate (rs[Rs_font]); - TermWin.fwidth = TermWin.fontset->base_font ()->width; - TermWin.fheight = TermWin.fontset->base_font ()->height; - TermWin.fbase = TermWin.fontset->base_font ()->ascent; - #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ if (Options & Opt_reverseVideo) @@ -1139,7 +1133,13 @@ rxvt_term::create_windows (int argc, const char *const *argv) /* grab colors before netscape does */ Get_Colours (); - change_font (1, NULL); + if (!change_font (rs[Rs_font])) + { + fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); + destroy (); + return; + } + window_calc (0, 0); old_width = szHint.width; old_height = szHint.height; diff --git a/src/main.C b/src/main.C index 28f96b27..19ac20ee 100644 --- a/src/main.C +++ b/src/main.C @@ -717,13 +717,43 @@ rxvt_term::tt_winch () * fontname == FONT_UP - switch to bigger font * fontname == FONT_DN - switch to smaller font */ -void -rxvt_term::change_font (int init, const char *fontname) -{} +bool +rxvt_term::change_font (const char *fontname) +{ + if (fontname == FONT_UP) + { + // TODO + } + else if (fontname == FONT_DN) + { + // TODO + } + else + { + rxvt_fontset *fs = new rxvt_fontset (this); -void + if (fs && fs->populate (fontname)) + { + delete TermWin.fontset; + TermWin.fontset = fs; + TermWin.fwidth = fs->base_font ()->width; + TermWin.fheight = fs->base_font ()->height; + TermWin.fbase = fs->base_font ()->ascent; + + // TODO: screen needs to be told about new fonts + + return true; + } + } + + return false; +} + +bool rxvt_term::font_up_down (int n, int direction) -{} +{ + return false; +} /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ diff --git a/src/rxvt.h b/src/rxvt.h index 1d433350..fd797327 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -369,6 +369,7 @@ enum { /* * rxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) */ +#define XTerm_locale 9 /* change locale */ #define XTerm_Menu 10 /* set menu item */ #define XTerm_Pixmap 20 /* new bg pixmap */ #define XTerm_restoreFG 39 /* change default fg color */ @@ -1188,8 +1189,8 @@ struct rxvt_term : rxvt_vars { void privileges (int mode); void privileged_utmp (char action); void privileged_ttydev (char action); - void change_font (int init, const char *fontname); - void font_up_down (int n, int direction); + bool change_font (const char *fontname); + bool font_up_down (int n, int direction); void set_title (const char *str); void set_iconName (const char *str); void set_window_color (int idx, const char *color);