On Thu, Oct 11, 2007 at 08:12:18AM +0200, Abdelrazak Younes wrote: > Enrico Forestieri wrote: > > On Wed, Oct 10, 2007 at 12:07:51AM -0500, Bo Peng wrote: > >>> The first patch implements the ideas above (without ranges) and > >>> works perfectly. You can even mark as greek the chars and get the > >>> same behaviour as before. > >> I just tested this patch and it works as expected. > > > > Please, try the attached. It should be fully working with ranges > > and font attribute changes. > > > +int Paragraph::Pimpl::greekChars(odocstream & os, value_type c, > + Encoding const & encoding, pos_type & i) > +{ > + // The latex command is "\textgreek{x}" and we have to retain > + // "\textgreek{x" for the first char but only "x" for all subsequent > + // chars (this also works when we are passed untranslated unicode). > + docstring const latex1 = rtrim(encoding.latexChar(c), "}"); > + int length = latex1.length(); > + os << latex1; > + while (i < size() - 1) { > + char_type next = getChar(i + 1); > + if (Encodings::isGreekChar(next)) { > > I'd prefer: > if (Encodings::isGreekChar(next)) > + break;
See below, unless you really mean if (!...). > And then de-indent the rest. > > + Font prev_font; > + bool found = false; > + FontList::const_iterator cit = fontlist.begin(); > + FontList::const_iterator end = fontlist.end(); > + for (; cit != end; ++cit) { > + if (cit->pos() >= i && !found) { > + prev_font = cit->font(); > + found = true; > + } > + if (cit->pos() >= i + 1) > + break; > + } > + if (found && cit != end && prev_font != cit->font()) > > > AFAICS if 'found' is true than you cannot have 'cit == end'. AFAICS you have still to have your coffee ;-) -- Enrico