--- rxvt-unicode/src/rxvtfont.h 2009/03/29 13:36:03 1.26 +++ rxvt-unicode/src/rxvtfont.h 2010/03/30 23:36:14 1.29 @@ -68,6 +68,9 @@ { char *fontdesc; + enum { fontCount = 3 }; // 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 (); @@ -78,9 +81,13 @@ 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 + rxvt_font *get (uint32_t unicode, int id = fontCount) { - return fonts[id & 0x7f]; + bool dummy; + + id &= fontCount; + + return fonts[id == fontCount ? find_font_idx (unicode, dummy) : id]; } private: @@ -96,6 +103,7 @@ void clear (); rxvt_font *new_font (const char *name, codeset cs); void add_fonts (const char *desc); + int find_font_idx (uint32_t unicode, bool &careful); // same as find_font, but does not limit index }; #endif /* _DEFAULTFONT_H_ */