X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFontIterator.C;h=ab97a6f384c5c862bc13f0a6b224f3cf7585bc97;hb=8765ab59cdddad67284007813ef25934ea0042ce;hp=e32886eace53d6fde2976cc5130c705b156ccc58;hpb=93430a89da9a0a8192d56f318f52d44b99acea75;p=lyx.git diff --git a/src/FontIterator.C b/src/FontIterator.C index e32886eace..ab97a6f384 100644 --- a/src/FontIterator.C +++ b/src/FontIterator.C @@ -14,20 +14,24 @@ #include "FontIterator.h" +#include "buffer.h" #include "lyxtext.h" #include "paragraph.h" -FontIterator::FontIterator(LyXText const & text, lyx::par_type pit, - lyx::pos_type pos) - : text_(text), pit_(pit), pos_(pos), - font_(text.getFont(text.getPar(pit), pos)), - endspan_(text.getPar(pit).getEndPosOfFontSpan(pos)), - bodypos_(text.getPar(pit).beginOfBody()) +namespace lyx { + + +FontIterator::FontIterator(Buffer const & buffer, LyXText const & text, + Paragraph const & par, pos_type pos) + : buffer_(buffer), text_(text), par_(par), pos_(pos), + font_(text.getFont(buffer, par, pos)), + endspan_(par.fontSpan(pos).last), + bodypos_(par.beginOfBody()) {} -LyXFont FontIterator::operator*() const +LyXFont const & FontIterator::operator*() const { return font_; } @@ -43,8 +47,11 @@ FontIterator & FontIterator::operator++() { ++pos_; if (pos_ > endspan_ || pos_ == bodypos_) { - font_ = text_.getFont(text_.getPar(pit_), pos_); - endspan_ = text_.getPar(pit_).getEndPosOfFontSpan(pos_); + font_ = text_.getFont(buffer_, par_, pos_); + endspan_ = par_.fontSpan(pos_).last; } return *this; } + + +} // namespace lyx