{
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;
}
}
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;
}
}
* 50 = change font
*
* rxvt extensions:
+ * 9 = change locale (NYI)
* 10 = menu (may change in future)
* 20 = bg pixmap
* 39 = change default fg color
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 */
return true;
}
-void
+bool
rxvt_fontset::populate (const char *desc)
{
clear ();
}
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
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
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)
/* 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;
* 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;
+}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* 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 */
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);