--- rxvt-unicode/src/rxvtfont.h 2007/10/18 09:11:43 1.24 +++ rxvt-unicode/src/rxvtfont.h 2010/03/30 23:36:14 1.29 @@ -15,7 +15,8 @@ struct rxvt_term; -struct rxvt_fontprop { +struct rxvt_fontprop +{ enum { unset = -1, medium = 100, bold = 200, @@ -25,7 +26,8 @@ int weight, slant; }; -struct rxvt_font { +struct rxvt_font +{ // managed by the fontset rxvt_term *term; void set_term (rxvt_term *term) { this->term = term; } @@ -38,7 +40,7 @@ int ascent, descent, width, height; - void set_name (char *name); + void set_name (char *name_); rxvt_font (); virtual ~rxvt_font () { free (name); }; @@ -62,9 +64,13 @@ struct rxvt_fallback_font; -struct rxvt_fontset { +struct rxvt_fontset +{ 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 (); @@ -75,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: @@ -93,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_ */