scramble email addresses
[lyx.git] / src / FontIterator.cpp
blobc4f553162c7aa9f1e91f209bb708a1229dc7973b
1 /**
2 * \file src/FontIterator.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
13 #include <config.h>
15 #include "FontIterator.h"
17 #include "TextMetrics.h"
18 #include "Paragraph.h"
21 namespace lyx {
24 FontIterator::FontIterator(TextMetrics const & tm,
25 Paragraph const & par, pit_type pit, pos_type pos)
26 : tm_(tm), par_(par), pit_(pit), pos_(pos),
27 font_(tm.getDisplayFont(pit, pos)),
28 endspan_(par.fontSpan(pos).last),
29 bodypos_(par.beginOfBody())
33 Font const & FontIterator::operator*() const
35 return font_;
39 Font * FontIterator::operator->()
41 return &font_;
45 FontIterator & FontIterator::operator++()
47 ++pos_;
48 if (pos_ > endspan_ || pos_ == bodypos_) {
49 font_ = tm_.getDisplayFont(pit_, pos_);
50 endspan_ = par_.fontSpan(pos_).last;
52 return *this;
56 } // namespace lyx