repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 1b546698e4a7209c48a4a1a93143599f26652752:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 1b546698e4a7209c48a4a1a93143599f26652752
Author: Marc Lehmann 
Date:   Wed Mar 31 22:22:32 2010 +0000

    *** empty log message ***

diff --git a/src/main.C b/src/main.C
index f9fd82e091f5a3b1563f8e39c98557919051994f..
index ..6d2a7a6cdde8d6028f59520cd18b531697c911de 100644
--- a/src/main.C
+++ b/src/main.C
@@ -690,7 +690,7 @@ rxvt_term::set_fonts ()
   delete fontset[0];
   fontset[0] = fs;

-  prop = (*fs)[1]->properties ();
+  prop = (*fs)[rxvt_fontset::firstFont]->properties ();
   prop.height += lineSpace;
   prop.width += letterSpace;

diff --git a/src/rxvt.h b/src/rxvt.h
index 853056508d76468d5cb64c0566d9751c0b21eae8..
index ..205edf19adfaba54d2c3623aa4d48319beec7b80 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -321,7 +321,7 @@ enum {
 #define RS_Uline                0x00040000UL    // underline

 // toggle this to force redraw, must be != RS_Careful
-#define RS_redraw               0x01000000UL
+#define RS_redraw               0x02000000UL

 // 5 custom bits for extensions
 #define RS_customCount          32
@@ -329,7 +329,11 @@ enum {
 #define RS_customShift          19

 // other flags
-#define RS_Careful		0x80000000UL	/* be careful when drawing these */
+#define RS_Careful		0x10000000UL	/* be careful when drawing these */
+
+#define RS_fontCount		rxvt_fontset::fontCount
+#define RS_fontMask             0xf0000000UL    // plenty(?) of fonts, includes RS_Careful
+#define RS_fontShift            28

 #define RS_styleCount		4
 #define RS_styleMask		(RS_Bold | RS_Italic)
@@ -338,10 +342,6 @@ enum {
 #define RS_baseattrMask         (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline)
 #define RS_attrMask             (RS_baseattrMask | RS_fontMask)

-#define RS_fontCount		rxvt_fontset::fontCount
-#define RS_fontMask             0xff000000UL    // plenty(?) of fonts, includes RS_Careful
-#define RS_fontShift            24
-
 #define DEFAULT_RSTYLE  (RS_None | Color_fg | (Color_bg << Color_Bits))
 #define OVERLAY_RSTYLE  (RS_None | Color_Black | (Color_Yellow << Color_Bits))

diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 39b678e0d37ed44543b35882c8fdb842e0ae1175..
index ..e746c2fc10f3d9254259d5dcd2e6e6b84fce7c93 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -1674,8 +1674,7 @@ rxvt_fontset::find_font_idx (unicode_t unicode)
       bool careful;
       if (f->has_char (unicode, &prop, careful))
         {
-          if (careful)
-            i |= 128;
+          i = (i << 1) | careful;

           goto found;
         }
@@ -1764,7 +1763,6 @@ found:
 int
 rxvt_fontset::find_font (unicode_t unicode)
 {
-  int id = find_font_idx (unicode);
-
-  return min (fontCount, id & 127) | (id & 128 ? Careful : 0);
+  return min ((fontCount << 1) | 1, find_font_idx (unicode));
 }
+
diff --git a/src/rxvtfont.h b/src/rxvtfont.h
index 92711e6b620933eeaf3ac0c876abeabf5217fd85..
index ..598e3f9888c7e69d1e87328aadec441c41effa17 100644
--- a/src/rxvtfont.h
+++ b/src/rxvtfont.h
@@ -68,8 +68,8 @@ struct rxvt_fontset
 {
   char *fontdesc;

-  enum { fontCount = 127 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
-  enum { Careful = fontCount + 1 };
+  enum { fontCount = 7 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
+  enum { firstFont = 2 }; // index of first font in set

   rxvt_fontset (rxvt_term *term);
   ~rxvt_fontset ();
@@ -84,7 +84,7 @@ struct rxvt_fontset
   // font-id's MUST fit into a signed 16 bit integer, and within 0..255
   rxvt_font *operator [] (int id) const
   {
-    return fonts[id & fontCount];
+    return fonts[id >> 1];
   }

 private:

-----END OF PAGE-----