*** empty log message ***
authorroot <root>
Sun, 27 Aug 2006 10:10:25 +0000 (10:10 +0000)
committerroot <root>
Sun, 27 Aug 2006 10:10:25 +0000 (10:10 +0000)
Changes
src/main.C
src/rxvtfont.C
src/rxvtfont.h

diff --git a/Changes b/Changes
index b67c4bf..5a36d62 100644 (file)
--- a/Changes
+++ b/Changes
@@ -22,6 +22,8 @@ WISH: kick out xpm.C, replace by pixbuf
 DUMB: support tex fonts
 
 8.0
+       - specified fonts were incorrectly morphed to bold/italic according to the
+          basefont, even if explicitly specified (tracked down by tpope).
         - fixed urxvt::strwidth to calculate width in the same way as screen.C.
        - fix a crash caused by passing negative widths to overlay functions.
        - give proper diagnostic when RXVT_SOCKET is too long instead of
index 5156a8b..699c618 100644 (file)
@@ -834,17 +834,20 @@ rxvt_term::set_fonts ()
           rxvt_fontprop prop2 = prop;
 
           if (res)
-            prop2.weight = prop2.slant = rxvt_fontprop::unset;
+            {
+              fs->populate (res);
+              fs->set_prop (prop2, false);
+            }
           else
             {
-              res = fontset[0]->fontdesc;
+              fs->populate (fontset[0]->fontdesc);
 
               if (SET_STYLE (0, style) & RS_Bold)   prop2.weight = rxvt_fontprop::bold;
               if (SET_STYLE (0, style) & RS_Italic) prop2.slant  = rxvt_fontprop::italic;
+
+              fs->set_prop (prop2, true);
             }
 
-          fs->populate (res);
-          fs->set_prop (prop2, true);
         }
 #else
       fontset[style] = fontset[0];
index e59f0ad..56a35ed 100644 (file)
@@ -272,7 +272,7 @@ struct rxvt_font_default : rxvt_font {
     return p;
   }
 
-  bool load (const rxvt_fontprop &prop)
+  bool load (const rxvt_fontprop &prop, bool force_prop)
   {
     width = 1; height = 1;
     ascent = 1; descent = 0;
@@ -473,7 +473,7 @@ struct rxvt_font_x11 : rxvt_font {
 
   rxvt_fontprop properties ();
 
-  bool load (const rxvt_fontprop &prop);
+  bool load (const rxvt_fontprop &prop, bool force_prop);
 
   bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const;
 
@@ -629,7 +629,7 @@ replace_field (char *buf, const char *name, int index, const char old, const cha
 }
 
 bool
-rxvt_font_x11::load (const rxvt_fontprop &prop)
+rxvt_font_x11::load (const rxvt_fontprop &prop, bool force_prop)
 {
   dTermDisplay;
 
@@ -638,8 +638,7 @@ rxvt_font_x11::load (const rxvt_fontprop &prop)
   char field_str[64]; // enough for 128 bits
 
   // first morph the font if required
-  if (prop.weight != rxvt_fontprop::unset
-      || prop.slant != rxvt_fontprop::unset)
+  if (force_prop)
     {
       char fname[1024];
 
@@ -1041,7 +1040,7 @@ struct rxvt_font_xft : rxvt_font {
 
   rxvt_fontprop properties ();
 
-  bool load (const rxvt_fontprop &prop);
+  bool load (const rxvt_fontprop &prop, bool force_prop);
 
   void draw (rxvt_drawable &d, int x, int y,
              const text_t *text, int len,
@@ -1084,7 +1083,7 @@ rxvt_font_xft::properties ()
 }
 
 bool
-rxvt_font_xft::load (const rxvt_fontprop &prop)
+rxvt_font_xft::load (const rxvt_fontprop &prop, bool force_prop)
 {
   dTermDisplay;
 
@@ -1103,11 +1102,11 @@ rxvt_font_xft::load (const rxvt_fontprop &prop)
     FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height);
 
   if (prop.weight != rxvt_fontprop::unset
-      && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch)
+      && (force_prop || FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch))
     FcPatternAddInteger (p, FC_WEIGHT, prop.weight);
 
   if (prop.slant != rxvt_fontprop::unset
-      && FcPatternGet (p, FC_SLANT, 0, &v) != FcResultMatch)
+      && (force_prop || FcPatternGet (p, FC_SLANT, 0, &v) != FcResultMatch))
     FcPatternAddInteger (p, FC_SLANT, prop.slant);
 
 #if 0 // clipping unfortunately destroys our precious double-width-characters
@@ -1387,6 +1386,7 @@ rxvt_fontset::clear ()
 {
   prop.width = prop.height = prop.ascent = prop.weight = prop.slant
     = rxvt_fontprop::unset;
+  force_prop = false;
 
   for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++)
     FONT_UNREF (*i);
@@ -1508,7 +1508,7 @@ rxvt_fontset::realize_font (int i)
 
   fonts[i]->loaded = true;
 
-  if (!fonts[i]->load (prop))
+  if (!fonts[i]->load (prop, force_prop))
     {
       fonts[i]->cs = CS_UNKNOWN;
       return false;
index a70ead4..62fb2e2 100644 (file)
@@ -62,7 +62,7 @@ struct rxvt_font {
 
   virtual rxvt_fontprop properties () = 0;
 
-  virtual bool load (const rxvt_fontprop &morph) = 0;
+  virtual bool load (const rxvt_fontprop &morph, bool force_prop) = 0;
   virtual bool has_char (uint32_t unicode, const rxvt_fontprop *prop, bool &careful) const = 0;
 
   virtual void draw (rxvt_drawable &d,
@@ -82,7 +82,7 @@ struct rxvt_fontset {
   ~rxvt_fontset ();
 
   bool populate (const char *desc);
-  void set_prop (const rxvt_fontprop &prop) { this->prop = prop; }
+  void set_prop (const rxvt_fontprop &prop, bool force_prop) { this->prop = prop; this->force_prop = force_prop; }
   int find_font (uint32_t unicode);
   int find_font (const char *name) const;
   bool realize_font (int i);
@@ -96,6 +96,7 @@ struct rxvt_fontset {
 private:
   rxvt_term *term;
   rxvt_fontprop prop;
+  bool force_prop;
   simplevec<rxvt_font *> fonts;
   const rxvt_fallback_font *fallback;