scramble email addresses
[lyx.git] / src / FontIterator.h
blob44ecb3790813371662cc0c4de11a9cb2a7b628fb
1 // -*- C++ -*-
2 /**
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 Text::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
23 #include "Font.h"
25 #include "support/types.h"
28 namespace lyx {
30 class Paragraph;
31 class TextMetrics;
34 class FontIterator : std::iterator<std::forward_iterator_tag, Font>
36 public:
37 ///
38 FontIterator(TextMetrics const & tm,
39 Paragraph const & par, pit_type pit, pos_type pos);
40 ///
41 Font const & operator*() const;
42 ///
43 FontIterator & operator++();
44 ///
45 Font * operator->();
47 private:
48 ///
49 TextMetrics const & tm_;
50 ///
51 Paragraph const & par_;
52 ///
53 pit_type pit_;
54 ///
55 pos_type pos_;
56 ///
57 Font font_;
58 ///
59 pos_type endspan_;
60 ///
61 pos_type bodypos_;
65 } // namespace lyx
67 #endif // FONTITERATOR_H