]> git.lyx.org Git - lyx.git/blob - src/FontIterator.cpp
start using FileName::exists()
[lyx.git] / src / FontIterator.cpp
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.
5  *
6  * \author Alfredo Braunstein
7  *
8  * Full author contact details are available in file CREDITS.
9  *
10  */
11
12
13 #include <config.h>
14
15 #include "FontIterator.h"
16
17 #include "TextMetrics.h"
18 #include "Paragraph.h"
19
20
21 namespace lyx {
22
23
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())
30 {}
31
32
33 Font const & FontIterator::operator*() const
34 {
35         return font_;
36 }
37
38
39 Font * FontIterator::operator->()
40 {
41         return &font_;
42 }
43
44
45 FontIterator & FontIterator::operator++()
46 {
47         ++pos_;
48         if (pos_ > endspan_ || pos_ == bodypos_) {
49                 font_ = tm_.getDisplayFont(pit_, pos_);
50                 endspan_ = par_.fontSpan(pos_).last;
51         }
52         return *this;
53 }
54
55
56 } // namespace lyx