3 * \file src/FontIterator.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alfredo Braunstein
9 * Full author contact details are available in file CREDITS.
12 * Calling LyXText::getFont is slow. While rebreaking we scan a
13 * paragraph from left to right calling getFont for every char. This
14 * simple class address this problem by hidding an optimization trick
15 * (not mine btw -AB): the font is reused in the whole font span. The
16 * class handles transparently the "hidden" (not part of the fontlist)
17 * label font (as getFont does).
20 #ifndef FONTITERATOR_H
21 #define FONTITERATOR_H
25 #include "support/types.h"
31 class FontIterator : std::iterator<std::forward_iterator_tag, LyXFont>
35 FontIterator(LyXText const & text, Paragraph const & par, lyx::pos_type pos);
37 LyXFont operator*() const;
39 FontIterator & operator++();
41 LyXFont * operator->();
45 LyXText const & text_;
47 Paragraph const & par_;
53 lyx::pos_type endspan_;
55 lyx::pos_type bodypos_;
58 #endif // FONTITERATOR_H