1 typedef unsigned int size_t;
2 typedef struct _GObject {
5 struct input_iterator_tag {
7 struct forward_iterator_tag:public input_iterator_tag {
9 struct bidirectional_iterator_tag:public forward_iterator_tag {
11 struct random_access_iterator_tag:public bidirectional_iterator_tag {
13 template < typename _Iterator > struct iterator_traits {
15 template < typename _Tp > struct iterator_traits <_Tp * > {
16 typedef random_access_iterator_tag iterator_category;
17 typedef int difference_type;
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 <
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 {
34 template < typename _IteratorL, typename _IteratorR,
35 typename _Container > inline typename __normal_iterator <
37 _Container >::difference_type operator-(const __normal_iterator <
40 const __normal_iterator <
42 _Container > &__rhs) {
43 return __lhs.base() - __rhs.base();
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;
56 template < typename _Tp >
57 class allocator:public __gnu_cxx::new_allocator < _Tp > {
60 extern double fabs(double);
64 } namespace Inkscape {
69 enum CollectionPolicy {
72 template < ScanPolicy default_scan =
73 SCANNED, CollectionPolicy default_collect =
74 AUTO > class Managed {
80 protected:Anchored():_anchor(__null)
82 } private:struct Anchor:public Managed < SCANNED,
85 mutable Anchor *_anchor;
90 class View:public GC::Managed <>, public GC::Finalized,
93 }}} struct SPDesktop:public Inkscape::UI::View::View {
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
100 struct SPILengthOrNormal {
106 SPILengthOrNormal line_height;
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 {
116 public:_Vector_impl _M_impl;
118 template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
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 {
143 public:class iterator;
144 inline iterator end() const;
145 inline unsigned lineIndex(iterator const &it) const;
150 inline Chunk const &chunk(Layout const *l) const {
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
167 class Layout::iterator {
168 public:friend class Layout;
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),
181 inline Layout::iterator Layout::end() const {
182 return iterator(this, _characters.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;
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,
196 Inkscape::Text::Layout const *layout;
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);
203 switch (style->line_height.unit) {
204 case SP_CSS_UNIT_NONE:
206 if (fabs(style->line_height.computed) < 0.001)
207 style->line_height.computed = by;
209 style->line_height.computed *=
210 (average_line_height + zby) / average_line_height;
213 case SP_CSS_UNIT_PERCENT:
214 if (fabs(style->line_height.value) < 0.001)
215 style->line_height.value = by;
217 style->line_height.value *=
218 (average_line_height + zby) / average_line_height;