--- rxvt-unicode/src/rxvtfont.h 2007/06/25 13:50:41 1.23 +++ rxvt-unicode/src/rxvtfont.h 2010/03/30 23:00:35 1.28 @@ -6,19 +6,6 @@ # include #endif -#ifdef HAVE_XSETLOCALE -# define X_LOCALE -# include -#else -# ifdef HAVE_SETLOCALE -# include -# endif -#endif - -#ifdef HAVE_NL_LANGINFO -# include -#endif - #include #include "feature.h" @@ -28,7 +15,8 @@ struct rxvt_term; -struct rxvt_fontprop { +struct rxvt_fontprop +{ enum { unset = -1, medium = 100, bold = 200, @@ -38,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; } @@ -51,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); }; @@ -75,22 +64,28 @@ struct rxvt_fallback_font; -struct rxvt_fontset { +struct rxvt_fontset +{ char *fontdesc; + enum { fontCount = 127 }; // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h + 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); // same as find_font, but does not limit index 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 + rxvt_font *get (uint32_t unicode, int id = fontCount) { - return fonts[id & 0x7f]; + id &= fontCount; + + return fonts[id == fontCount ? find_font_ (unicode) : id]; } private: