repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 238c23521c12f00a097bae98657fd0ce4115eae7: path_to: revision_to:
commit 238c23521c12f00a097bae98657fd0ce4115eae7 Author: Marc LehmannDate: Wed Mar 31 22:46:40 2010 +0000 *** empty log message *** diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -320,7 +320,7 @@ enum {
#define RS_RVid 0x00020000UL // reverse video
#define RS_Uline 0x00040000UL // underline
-// toggle this to force redraw, must be != RS_Careful
+// toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral"
#define RS_redraw 0x02000000UL
// 5 custom bits for extensions
diff --git a/src/rxvtfont.C b/src/rxvtfont.C
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -484,10 +484,10 @@ rxvt_font_default::draw (rxvt_drawable &d, int x, int y,
}
}
-struct rxvt_font_meta : rxvt_font {
+struct rxvt_font_overflow : rxvt_font {
struct rxvt_fontset *fs;
- rxvt_font_meta (rxvt_fontset *fs)
+ rxvt_font_overflow (rxvt_fontset *fs)
: rxvt_font ()
{
this->fs = fs;
@@ -510,7 +510,7 @@ struct rxvt_font_meta : rxvt_font {
width = 1; height = 1;
ascent = 1; descent = 0;
- set_name (strdup ("built-in meta font"));
+ set_name (strdup ("built-in rendition overflow font"));
return true;
}
@@ -1496,6 +1496,15 @@ rxvt_fontset::clear ()
fallback = fallback_fonts;
}
+void
+rxvt_fontset::prepare_font (rxvt_font *font, codeset cs)
+{
+ font->set_term (term);
+
+ font->cs = cs;
+ font->loaded = false;
+}
+
rxvt_font *
rxvt_fontset::new_font (const char *name, codeset cs)
{
@@ -1521,17 +1530,28 @@ rxvt_fontset::new_font (const char *name, codeset cs)
else
f = new rxvt_font_x11;
- f->set_term (term);
f->set_name (strdup (name));
-
- f->cs = cs;
- f->loaded = false;
+ prepare_font (f, cs);
return f;
}
/////////////////////////////////////////////////////////////////////////////
+void
+rxvt_fontset::push_font (rxvt_font *font)
+{
+ if (fonts.size () == fontCount)
+ {
+ rxvt_font *f = new rxvt_font_overflow (this);
+
+ prepare_font (f, CS_UNICODE);
+ fonts.push_back (f);
+ }
+
+ fonts.push_back (font);
+}
+
void
rxvt_fontset::add_fonts (const char *desc)
{
@@ -1581,7 +1601,7 @@ rxvt_fontset::add_fonts (const char *desc)
memcpy (buf, desc, end - desc);
buf[end - desc] = 0;
- fonts.push_back (new_font (buf, cs));
+ push_font (new_font (buf, cs));
}
else
rxvt_warn ("fontset element too long (>511 bytes), ignored.");
@@ -1619,7 +1639,7 @@ rxvt_fontset::populate (const char *desc)
fontdesc = strdup (desc);
- fonts.push_back (new_font (0, CS_UNICODE));
+ push_font (new_font (0, CS_UNICODE));
realize_font (0);
add_fonts (desc);
@@ -1685,7 +1705,7 @@ rxvt_fontset::find_font_idx (unicode_t unicode)
if (fallback->name)
{
// search through the fallback list
- fonts.push_back (new_font (fallback->name, fallback->cs));
+ push_font (new_font (fallback->name, fallback->cs));
fallback++;
}
else
@@ -1728,7 +1748,7 @@ rxvt_fontset::find_font_idx (unicode_t unicode)
char fontname[4096];
snprintf (fontname, sizeof (fontname), "xft:%s", font);
- fonts.push_back (new_font (fontname, CS_UNICODE));
+ push_font (new_font (fontname, CS_UNICODE));
}
free (font);
@@ -1760,9 +1780,3 @@ found:
return i;
}
-int
-rxvt_fontset::find_font (unicode_t unicode)
-{
- return min ((fontCount << 1) | 1, find_font_idx (unicode));
-}
-
diff --git a/src/rxvtfont.h b/src/rxvtfont.h
--- a/src/rxvtfont.h
+++ b/src/rxvtfont.h
@@ -68,7 +68,7 @@ struct rxvt_fontset
{
char *fontdesc;
- enum { fontCount = 7 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
+ enum { fontCount = 3 }; // 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);
@@ -77,16 +77,20 @@ struct rxvt_fontset
bool populate (const char *desc);
void set_prop (const rxvt_fontprop &prop, bool force_prop) { this->prop = prop; this->force_prop = force_prop; }
int find_font_idx (uint32_t unicode);
- int find_font (uint32_t unicode);
int find_font (const char *name) const;
bool realize_font (int i);
- // font-id's MUST fit into a signed 16 bit integer, and within 0..255
rxvt_font *operator [] (int id) const
{
return fonts[id >> 1];
}
+ int
+ find_font (unicode_t unicode)
+ {
+ return min ((fontCount << 1) | 1, find_font_idx (unicode));
+ }
+
private:
rxvt_term *term;
rxvt_fontprop prop;
@@ -99,7 +103,9 @@ private:
void clear ();
rxvt_font *new_font (const char *name, codeset cs);
+ void prepare_font (rxvt_font *font, codeset cs);
void add_fonts (const char *desc);
+ void push_font (rxvt_font *font);
};
#endif /* _DEFAULTFONT_H_ */
-----END OF PAGE-----