From: root Date: Tue, 30 Mar 2010 23:00:35 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?p=dana%2Furxvt.git;a=commitdiff_plain;h=8f817de0755b3b580cbfa84ee632d4150151fc6b *** empty log message *** --- diff --git a/src/command.C b/src/command.C index efc6f68..986fc7f 100644 --- a/src/command.C +++ b/src/command.C @@ -200,7 +200,7 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) fname = rxvt_temp_buf (len); for (int i = 0; i < len; i++) { - rxvt_font *f = (*fs)[fs->find_font (chr[i])]; + rxvt_font *f = fs->get (chr[i]); fname[i] = rxvt_utf8towcs (f->name); max_it (width, wcswidth (fname[i], wcslen (fname[i]))); } diff --git a/src/main.C b/src/main.C index c0aefd7..0c323bc 100644 --- a/src/main.C +++ b/src/main.C @@ -690,7 +690,7 @@ rxvt_term::set_fonts () delete fontset[0]; fontset[0] = fs; - prop = (*fs)[1]->properties (); + prop = fs->get (0, 1)->properties (); prop.height += lineSpace; prop.width += letterSpace; diff --git a/src/rxvtfont.C b/src/rxvtfont.C index af16b2f..c49edf0 100644 --- a/src/rxvtfont.C +++ b/src/rxvtfont.C @@ -450,7 +450,7 @@ rxvt_font_default::draw (rxvt_drawable &d, int x, int y, chrs [1] = NOCHAR; *chrs = cc->c1; - rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; + rxvt_font *f1 = fs->get (cc->c1); f1->draw (d, x, y, chrs, width, fg, bg); if (cc->c2 != NOCHAR) @@ -461,7 +461,7 @@ rxvt_font_default::draw (rxvt_drawable &d, int x, int y, *chrs = cc->c2; rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful) ? f1 - : (*fs)[fs->find_font (cc->c2)]; + : fs->get (cc->c2); f2->draw (d, x, y, chrs, width, fg, Color_none); } @@ -1588,7 +1588,7 @@ rxvt_fontset::find_font (const char *name) const } int -rxvt_fontset::find_font (unicode_t unicode) +rxvt_fontset::find_font_ (unicode_t unicode) { if (unicode >= 1<<20) return 0; @@ -1711,5 +1711,11 @@ found: return i; } +int +rxvt_fontset::find_font (unicode_t unicode) +{ + return min (fontCount, find_font_ (unicode)); +} + diff --git a/src/rxvtfont.h b/src/rxvtfont.h index ed20a2e..1437902 100644 --- a/src/rxvtfont.h +++ b/src/rxvtfont.h @@ -75,14 +75,17 @@ struct 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 & fontCount]; + id &= fontCount; + + return fonts[id == fontCount ? find_font_ (unicode) : id]; } private: diff --git a/src/screen.C b/src/screen.C index 8ccba89..0a20423 100644 --- a/src/screen.C +++ b/src/screen.C @@ -2379,7 +2379,7 @@ rxvt_term::scr_refresh () NOTHROW /* * Actually do the drawing of the string here */ - rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; + rxvt_font *font = fontset [GET_STYLE (rend)]->get (*text, GET_FONT (rend)); if (expect_true (have_bg && back == Color_bg)) {