--- rxvt-unicode/src/rxvtfont.h 2010/03/30 23:36:14 1.29 +++ rxvt-unicode/src/rxvtfont.h 2010/03/31 22:46:40 1.34 @@ -34,7 +34,7 @@ char *name; codeset cs; - bool loaded; // wether we tried loading it before (not wether it's loaded) + bool loaded; // whether we tried loading it before (not whether it's loaded) // managed by the font object int ascent, descent, @@ -69,25 +69,26 @@ char *fontdesc; enum { fontCount = 3 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h - enum { Careful = fontCount + 1 }; + enum { firstFont = 2 }; // index of first font in set 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 (uint32_t unicode); + int find_font_idx (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 *get (uint32_t unicode, int id = fontCount) + rxvt_font *operator [] (int id) const { - bool dummy; - - id &= fontCount; + return fonts[id >> 1]; + } - return fonts[id == fontCount ? find_font_idx (unicode, dummy) : id]; + int + find_font (unicode_t unicode) + { + return min ((fontCount << 1) | 1, find_font_idx (unicode)); } private: @@ -102,8 +103,9 @@ 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); - int find_font_idx (uint32_t unicode, bool &careful); // same as find_font, but does not limit index + void push_font (rxvt_font *font); }; #endif /* _DEFAULTFONT_H_ */