]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | typedef unsigned int size_t; |
2 | typedef struct _GObject { | |
3 | } GObject; | |
4 | namespace std { | |
5 | struct input_iterator_tag { | |
6 | }; | |
7 | struct forward_iterator_tag:public input_iterator_tag { | |
8 | }; | |
9 | struct bidirectional_iterator_tag:public forward_iterator_tag { | |
10 | }; | |
11 | struct random_access_iterator_tag:public bidirectional_iterator_tag { | |
12 | }; | |
13 | template < typename _Iterator > struct iterator_traits { | |
14 | }; | |
15 | template < typename _Tp > struct iterator_traits <_Tp * > { | |
16 | typedef random_access_iterator_tag iterator_category; | |
17 | typedef int difference_type; | |
18 | }; | |
19 | } namespace __gnu_cxx { | |
20 | using std::iterator_traits; | |
21 | template < typename _Iterator, | |
22 | typename _Container > class __normal_iterator { | |
23 | protected:_Iterator _M_current; | |
24 | public:typedef typename iterator_traits < | |
25 | _Iterator >:: | |
26 | iterator_category iterator_category; | |
27 | typedef typename iterator_traits < | |
28 | _Iterator >::difference_type difference_type; | |
29 | explicit __normal_iterator(const _Iterator & | |
30 | __i):_M_current(__i) { | |
31 | } const _Iterator & base() const { | |
32 | return _M_current; | |
33 | }}; | |
34 | template < typename _IteratorL, typename _IteratorR, | |
35 | typename _Container > inline typename __normal_iterator < | |
36 | _IteratorL, | |
37 | _Container >::difference_type operator-(const __normal_iterator < | |
38 | _IteratorL, | |
39 | _Container > &__lhs, | |
40 | const __normal_iterator < | |
41 | _IteratorR, | |
42 | _Container > &__rhs) { | |
43 | return __lhs.base() - __rhs.base(); | |
44 | } | |
45 | template < typename _Tp > class new_allocator { | |
46 | public:typedef size_t size_type; | |
47 | typedef const _Tp *const_pointer; | |
48 | typedef const _Tp & const_reference; | |
49 | template < typename _Tp1 > struct rebind { | |
50 | typedef new_allocator < _Tp1 > other; | |
51 | }; | |
52 | }; | |
53 | } | |
54 | ||
55 | namespace std { | |
56 | template < typename _Tp > | |
57 | class allocator:public __gnu_cxx::new_allocator < _Tp > { | |
58 | }; | |
59 | } | |
60 | extern double fabs(double); | |
61 | namespace NR { | |
62 | class Point { | |
63 | }; | |
64 | } namespace Inkscape { | |
65 | namespace GC { | |
66 | enum ScanPolicy { | |
67 | SCANNED | |
68 | }; | |
69 | enum CollectionPolicy { | |
70 | AUTO, MANUAL | |
71 | }; | |
72 | template < ScanPolicy default_scan = | |
73 | SCANNED, CollectionPolicy default_collect = | |
74 | AUTO > class Managed { | |
75 | }; | |
76 | class Finalized { | |
77 | public:Finalized() { | |
78 | }}; | |
79 | class Anchored { | |
80 | protected:Anchored():_anchor(__null) | |
81 | { | |
82 | } private:struct Anchor:public Managed < SCANNED, | |
83 | MANUAL > { | |
84 | }; | |
85 | mutable Anchor *_anchor; | |
86 | }; | |
87 | } | |
88 | namespace UI { | |
89 | namespace View { | |
90 | class View:public GC::Managed <>, public GC::Finalized, | |
91 | public GC::Anchored { | |
92 | }; | |
93 | }}} struct SPDesktop:public Inkscape::UI::View::View { | |
94 | }; | |
95 | enum SPMarkerLoc { | |
96 | SP_CSS_UNIT_NONE, SP_CSS_UNIT_PX, SP_CSS_UNIT_PT, SP_CSS_UNIT_PC, | |
97 | SP_CSS_UNIT_MM, SP_CSS_UNIT_CM, SP_CSS_UNIT_IN, SP_CSS_UNIT_EM, | |
98 | SP_CSS_UNIT_EX, SP_CSS_UNIT_PERCENT | |
99 | }; | |
100 | struct SPILengthOrNormal { | |
101 | unsigned unit:4; | |
102 | float value; | |
103 | float computed; | |
104 | }; | |
105 | struct SPStyle { | |
106 | SPILengthOrNormal line_height; | |
107 | }; | |
108 | namespace std { | |
109 | template < typename _Tp, typename _Alloc > struct _Vector_base { | |
110 | typedef typename _Alloc::template rebind < | |
111 | _Tp >::other _Tp_alloc_type; | |
112 | struct _Vector_impl:public _Tp_alloc_type { | |
113 | _Tp *_M_start; | |
114 | _Tp *_M_finish; | |
115 | }; | |
116 | public:_Vector_impl _M_impl; | |
117 | }; | |
118 | template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp, | |
119 | _Alloc > | |
120 | { | |
121 | typedef _Vector_base < _Tp, _Alloc > _Base; | |
122 | typedef vector < _Tp, _Alloc > vector_type; | |
123 | typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; | |
124 | public:typedef _Tp value_type; | |
125 | typedef typename _Tp_alloc_type::const_pointer const_pointer; | |
126 | typedef typename _Tp_alloc_type:: | |
127 | const_reference const_reference; | |
128 | typedef __gnu_cxx::__normal_iterator < const_pointer, | |
129 | vector_type > const_iterator; | |
130 | typedef size_t size_type; | |
131 | const_iterator begin() const { | |
132 | return const_iterator(this->_M_impl._M_start); | |
133 | } const_iterator end() const { | |
134 | return const_iterator(this->_M_impl._M_finish); | |
135 | } size_type size() const { | |
136 | return size_type(end() - begin()); | |
137 | } const_reference operator[] (size_type __n) const { | |
138 | }}; | |
139 | } | |
140 | namespace Inkscape { | |
141 | namespace Text { | |
142 | class Layout { | |
143 | public:class iterator; | |
144 | inline iterator end() const; | |
145 | inline unsigned lineIndex(iterator const &it) const; | |
146 | struct Chunk; | |
147 | struct Glyph { | |
148 | }; | |
149 | struct Character { | |
150 | inline Chunk const &chunk(Layout const *l) const { | |
151 | }}; | |
152 | struct Chunk { | |
153 | unsigned in_line; | |
154 | }; | |
155 | struct Line { | |
156 | }; | |
157 | std::vector < Line > _lines; | |
158 | std::vector < Character > _characters; | |
159 | std::vector < Glyph > _glyphs; | |
160 | class PredicateLineToCharacter { | |
161 | Layout const *const _flow; | |
162 | public:inline PredicateLineToCharacter(Layout const | |
163 | *flow):_flow | |
164 | (flow) { | |
165 | }}; | |
166 | }; | |
167 | class Layout::iterator { | |
168 | public:friend class Layout; | |
169 | private:Layout const | |
170 | *_parent_layout; | |
171 | int _glyph_index; | |
172 | unsigned _char_index; | |
173 | bool _cursor_moving_vertically; | |
174 | double _x_coordinate; | |
175 | inline iterator(Layout const *p, unsigned c, | |
176 | int g):_parent_layout(p), | |
177 | _glyph_index(g), _char_index(c), | |
178 | _cursor_moving_vertically(false), | |
179 | _x_coordinate(0.0) { | |
180 | }}; | |
181 | inline Layout::iterator Layout::end() const { | |
182 | return iterator(this, _characters.size(), | |
183 | _glyphs.size()); | |
184 | } inline unsigned Layout::lineIndex(iterator const &it) const { | |
185 | return it._char_index == | |
186 | _characters.size()? _lines.size() - | |
187 | 1 : _characters[it._char_index].chunk(this).in_line; | |
188 | }}}; | |
189 | void sp_te_adjust_linespacing_screen(GObject * text, | |
190 | Inkscape::Text::Layout:: | |
191 | iterator const &start, | |
192 | Inkscape::Text::Layout:: | |
193 | iterator const &end, SPDesktop * desktop, | |
194 | double by) | |
195 | { | |
196 | Inkscape::Text::Layout const *layout; | |
197 | SPStyle *style; | |
198 | unsigned line_count = layout->lineIndex(layout->end()); | |
199 | double all_lines_height; | |
200 | double average_line_height = | |
201 | all_lines_height / (line_count == 0 ? 1 : line_count); | |
202 | double zby; | |
203 | switch (style->line_height.unit) { | |
204 | case SP_CSS_UNIT_NONE: | |
205 | default: | |
206 | if (fabs(style->line_height.computed) < 0.001) | |
207 | style->line_height.computed = by; | |
208 | else | |
209 | style->line_height.computed *= | |
210 | (average_line_height + zby) / average_line_height; | |
211 | case SP_CSS_UNIT_EM: | |
212 | case SP_CSS_UNIT_EX: | |
213 | case SP_CSS_UNIT_PERCENT: | |
214 | if (fabs(style->line_height.value) < 0.001) | |
215 | style->line_height.value = by; | |
216 | else | |
217 | style->line_height.value *= | |
218 | (average_line_height + zby) / average_line_height; | |
219 | } | |
220 | } |