summaryrefslogtreecommitdiffstats
path: root/ksvg/impl/libs/libtext2path/src/Glyph.cpp
blob: 08ad55a8562ebb412472e72ad9ab3f6fadd02eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
/*    Copyright (C) 2003 Nikolas Zimmermann <[email protected]>
    This file is part of the KDE project

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    aint with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include <iostream>
#include "Glyph.h"

using namespace T2P;

Glyph::Glyph()
{
	m_bezierPath = 0;
}

Glyph::~Glyph()
{
	delete m_bezierPath;
	m_bezierPath = 0;
}

Affine &Glyph::affine()
{
	return m_affine;
}

void Glyph::setAffine(const Affine &affine)
{
	m_affine = affine;
}

const BezierPath *Glyph::bezierPath() const
{
	return const_cast<const BezierPath *>(m_bezierPath);
}

BezierPath *Glyph::modifiableBezierPath()
{
	return m_bezierPath;
}

void Glyph::setBezierPath(const BezierPath *bpath)
{
	m_bezierPath = const_cast<BezierPath *>(bpath);
}

FT_BBox *Glyph::ftBbox()
{
	return m_ftBbox;
}

// #####

GlyphAffinePair::GlyphAffinePair(const Glyph *glyph, const Affine &affine)
{
	m_glyph = glyph;
	m_affine = affine;
	m_transformatedPath = 0;
}

GlyphAffinePair::~GlyphAffinePair()
{
	// The glyphs are shared and thus not deleted (Niko)
	delete m_transformatedPath;
}

void GlyphAffinePair::setTransformatedPath(const BezierPath *path)
{
	m_transformatedPath = path;
}

const BezierPath *GlyphAffinePair::transformatedPath() const
{
	return m_transformatedPath;
}

const Glyph *GlyphAffinePair::glyph() const
{
	return m_glyph;
}

Affine &GlyphAffinePair::affine()
{
	return m_affine;
}

// #####

GlyphSet::GlyphSet()
{
	m_glyphCount = 0;
	
	m_bboxX = 0;
	m_bboxY = 0;
	m_width = 0;
	m_height = 0;
	
	m_xpen = 0;
	m_ypen = 0;

	m_underlinePosition = 0;
	m_underlineThickness = 0;
	m_overlinePosition = 0;
	m_strikeThroughPosition = 0;
	m_pixelBaseline = 0;
}

GlyphSet::~GlyphSet()
{
	m_set.clear();
}

std::vector<GlyphAffinePair *> &GlyphSet::set()
{
	return m_set;
}

std::list<float> GlyphSet::glyphXAdvance()
{
	return m_glyphXAdvance;
}

std::list<float> GlyphSet::glyphYAdvance()
{
	return m_glyphYAdvance;
}

unsigned int GlyphSet::glyphCount() const
{
	return m_glyphCount;
}

int GlyphSet::width() const
{
	return m_width;
}

int GlyphSet::height() const
{
	return m_height;
}

int GlyphSet::bboxX() const
{
	return m_bboxX;
}

int GlyphSet::bboxY() const
{
	return m_bboxY;
}

double GlyphSet::xpen() const
{
	return m_xpen;
}

double GlyphSet::ypen() const
{
	return m_ypen;
}

int GlyphSet::underlinePosition() const
{
	return m_underlinePosition;
}

int GlyphSet::underlineThickness() const
{
	return m_underlineThickness;
}

int GlyphSet::overlinePosition() const
{
	return m_overlinePosition;
}

int GlyphSet::strikeThroughPosition() const
{
	return m_strikeThroughPosition;
}

int GlyphSet::pixelBaseline() const
{
	return m_pixelBaseline;
}

// #####

GlyphLayoutParams::GlyphLayoutParams()
{
}

GlyphLayoutParams::~GlyphLayoutParams()
{
}

bool GlyphLayoutParams::tb() const
{
	return m_tb;
}

void GlyphLayoutParams::setTb(bool tb)
{
	m_tb = tb;
}

bool GlyphLayoutParams::useBidi() const
{
	return m_useBidi;
}

void GlyphLayoutParams::setUseBidi(bool bidi)
{
	m_useBidi = bidi;
}

double GlyphLayoutParams::wordSpacing() const
{
	return m_wordSpacing;
}

void GlyphLayoutParams::setWordSpacing(double wordSpacing)
{
	m_wordSpacing = wordSpacing;
}

double GlyphLayoutParams::letterSpacing() const
{
	return m_letterSpacing;
}

void GlyphLayoutParams::setLetterSpacing(double letterSpacing)
{
	m_letterSpacing = letterSpacing;
}

std::string GlyphLayoutParams::baselineShift() const
{
	return m_baseline;
}

void GlyphLayoutParams::setBaselineShift(const std::string &baseline)
{
	m_baseline = baseline;
}

int GlyphLayoutParams::glyphOrientationVertical() const
{
	return m_glyphOrientationVertical;
}

void GlyphLayoutParams::setGlyphOrientationVertical(int orient)
{
	m_glyphOrientationVertical = orient;
}

int GlyphLayoutParams::glyphOrientationHorizontal() const
{
	return m_glyphOrientationHorizontal;
}

void GlyphLayoutParams::setGlyphOrientationHorizontal(int orient)
{
	m_glyphOrientationHorizontal = orient;
}

double GlyphLayoutParams::textPathStartOffset() const
{
	return m_textPathStartOffset;
}

void GlyphLayoutParams::setTextPathStartOffset(double offset)
{
	m_textPathStartOffset = offset;
}

// #####

GlyphRenderParams::GlyphRenderParams()
{
}

GlyphRenderParams::~GlyphRenderParams()
{
}

Font *GlyphRenderParams::font() const
{
	return m_font;
}

void GlyphRenderParams::setFont(Font *font)
{
	m_font = font;
}
	
const GlyphLayoutParams *GlyphRenderParams::tqlayout() const
{
	return m_layout;
}

void GlyphRenderParams::setLayout(const GlyphLayoutParams *tqlayout)
{
	m_layout = tqlayout;
}

unsigned int GlyphRenderParams::glyphIndex() const
{
	return m_glyphIndex;
}

void GlyphRenderParams::setGlyphIndex(unsigned int glyphIndex)
{
	m_glyphIndex = glyphIndex;
}

unsigned int GlyphRenderParams::lastGlyph() const
{
	return m_lastGlyph;
}

void GlyphRenderParams::setLastGlyph(unsigned int lastGlyph)
{
	m_lastGlyph = lastGlyph;
}

unsigned short GlyphRenderParams::character() const
{
	return m_character;
}

void GlyphRenderParams::setCharacter(unsigned short character)
{
	m_character = character;
}

// vim:ts=4:noet