*** empty log message ***
authorpcg <pcg>
Sun, 22 Feb 2004 08:28:36 +0000 (08:28 +0000)
committerpcg <pcg>
Sun, 22 Feb 2004 08:28:36 +0000 (08:28 +0000)
src/command.C
src/defaultfont.C
src/defaultfont.h
src/init.C
src/main.C
src/rxvt.h

index 92c332746811c8d6797d07ea68c6860eed20e795..4e0f9ff1826f6f6e8d5f49240b0361d65edac780 100644 (file)
@@ -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 */
index 736d4a0c6b6cb9c218123abbd613ced3bb28ab70..d72d9cf3df220df74d99c70a81bb322cf33c91b3 100644 (file)
@@ -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
index c6e917acd7391b72ca6a72ad336af2bb2fa7e8b6..3b9a6380b43e1c1276bab1503b2963a4660f882d 100644 (file)
@@ -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
index 7f2926176d3d65c124dd4e79c67db3af4f8c8055..914a357b0e6726f2a05dfd11eefc68d57118bbdb 100644 (file)
@@ -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;
index 28f96b278c2fe626672266215c70b03ee1a6c0aa..19ac20ee9149a22cdd71fbf9a8fe39f76e7506fa 100644 (file)
@@ -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;
+}
 
 /*----------------------------------------------------------------------*/
 /*----------------------------------------------------------------------*/
index 1d433350c0010dd30a2678239cd65b460a40a58e..fd797327c374919bd10e63b42f21797991d9b866 100644 (file)
@@ -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);