}
}
+struct rxvt_font_meta : rxvt_font {
+ struct rxvt_fontset *fs;
+
+ rxvt_font_meta (rxvt_fontset *fs)
+ : rxvt_font ()
+ {
+ this->fs = fs;
+ }
+
+ rxvt_fontprop properties ()
+ {
+ rxvt_fontprop p;
+
+ p.width = p.height = 1;
+ p.ascent = rxvt_fontprop::unset;
+ p.weight = rxvt_fontprop::medium;
+ p.slant = rxvt_fontprop::roman;
+
+ return p;
+ }
+
+ bool load (const rxvt_fontprop &prop, bool force_prop)
+ {
+ width = 1; height = 1;
+ ascent = 1; descent = 0;
+
+ set_name (strdup ("built-in meta font"));
+
+ return true;
+ }
+
+ bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
+ {
+ return false;
+ }
+
+ void draw (rxvt_drawable &d, int x, int y,
+ const text_t *text, int len,
+ int fg, int bg)
+ {
+ while (len--)
+ {
+ int fid = fs->find_font_idx (*text);
+ (*fs)[fid]->draw (d, x, y, text, 1, fg, bg);
+ ++text;
+ x += term->fwidth;
+ }
+ }
+};
+
/////////////////////////////////////////////////////////////////////////////
struct rxvt_font_x11 : rxvt_font {
}
int
-rxvt_fontset::find_font (unicode_t unicode)
+rxvt_fontset::find_font_idx (unicode_t unicode)
{
if (unicode >= 1<<20)
return 0;
return i;
}
+int
+rxvt_fontset::find_font (unicode_t unicode)
+{
+ int id = find_font_idx (unicode);
+
+ return min<int> (fontCount, id & 127) | (id & 128 ? Careful : 0);
+}
char *fontdesc;
enum { fontCount = 127 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
+ enum { Careful = fontCount + 1 };
rxvt_fontset (rxvt_term *term);
~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);