#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
}
}
-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;
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;
}
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)
{
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)
{
if (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.");
fontdesc = strdup (desc);
- fonts.push_back (new_font (0, CS_UNICODE));
+ push_font (new_font (0, CS_UNICODE));
realize_font (0);
add_fonts (desc);
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
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);
return i;
}
-int
-rxvt_fontset::find_font (unicode_t unicode)
-{
- return min<int> ((fontCount << 1) | 1, find_font_idx (unicode));
-}
-
{
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);
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<int> ((fontCount << 1) | 1, find_font_idx (unicode));
+ }
+
private:
rxvt_term *term;
rxvt_fontprop prop;
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_ */