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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_TOOLS_FONTENUM_HXX
#define INCLUDED_TOOLS_FONTENUM_HXX
#include <sal/types.h>
#include <sal/log.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <ostream>
enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN,
FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontFamily const& family)
{
switch (family)
{
case FAMILY_DONTKNOW:
return stream << "unknown";
case FAMILY_DECORATIVE:
return stream << "decorative";
case FAMILY_MODERN:
return stream << "modern";
case FAMILY_ROMAN:
return stream << "roman";
case FAMILY_SCRIPT:
return stream << "script";
case FAMILY_SWISS:
return stream << "swiss";
case FAMILY_SYSTEM:
return stream << "system";
default:
SAL_WARN("vcl.gdi", "FontFamily out of bounds");
assert(false && "FontFamily out of bounds");
return stream << "unknown";
}
}
enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontPitch const& pitch)
{
switch (pitch)
{
case PITCH_DONTKNOW:
return stream << "unknown";
case PITCH_FIXED:
return stream << "fixed";
case PITCH_VARIABLE:
return stream << "variable";
default:
SAL_WARN("vcl.gdi", "FontPitch out of bounds");
assert(false && "FontPitch out of bounds");
return stream << "unknown";
}
}
enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, TextAlign const& align)
{
switch (align)
{
case ALIGN_TOP:
return stream << "top";
case ALIGN_BASELINE:
return stream << "baseline";
case ALIGN_BOTTOM:
return stream << "bottom";
default:
SAL_WARN("vcl.gdi", "TextAlign out of bounds");
assert(false && "TextAlign out of bounds");
return stream << "unknown";
}
}
enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT,
WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL,
WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD,
WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontWeight const& weight)
{
switch (weight)
{
case WEIGHT_DONTKNOW:
return stream << "unknown";
case WEIGHT_THIN:
return stream << "thin";
case WEIGHT_ULTRALIGHT:
return stream << "ultralight";
case WEIGHT_LIGHT:
return stream << "light";
case WEIGHT_SEMILIGHT:
return stream << "semilight";
case WEIGHT_NORMAL:
return stream << "normal";
case WEIGHT_MEDIUM:
return stream << "medium";
case WEIGHT_SEMIBOLD:
return stream << "semibold";
case WEIGHT_BOLD:
return stream << "bold";
case WEIGHT_ULTRABOLD:
return stream << "ultrabold";
case WEIGHT_BLACK:
return stream << "black";
default:
SAL_WARN("vcl.gdi", "FontWeight out of bounds");
assert(false && "FontWeight out of bounds");
return stream << "unknown";
}
}
enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED,
WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL,
WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED,
WIDTH_ULTRA_EXPANDED,
FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontWidth const& width)
{
switch (width)
{
case WIDTH_DONTKNOW:
return stream << "unknown";
case WIDTH_ULTRA_CONDENSED:
return stream << "ultra condensed";
case WIDTH_EXTRA_CONDENSED:
return stream << "extra ultra condensed";
case WIDTH_CONDENSED:
return stream << "condensed";
case WIDTH_SEMI_CONDENSED:
return stream << "semi condensed";
case WIDTH_NORMAL:
return stream << "normal";
case WIDTH_SEMI_EXPANDED:
return stream << "semi expanded";
case WIDTH_EXPANDED:
return stream << "expanded";
case WIDTH_EXTRA_EXPANDED:
return stream << "extra expanded";
case WIDTH_ULTRA_EXPANDED:
return stream << "ultra expanded";
default:
SAL_WARN("vcl.gdi", "FontWidth out of bounds");
assert(false && "FontWidth out of bounds");
return stream << "unknown";
}
}
enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontItalic const& italic)
{
switch (italic)
{
case ITALIC_DONTKNOW:
return stream << "unknown";
case ITALIC_OBLIQUE:
return stream << "oblique";
case ITALIC_NORMAL:
return stream << "normal";
case ITALIC_NONE:
return stream << "none";
default:
SAL_WARN("vcl.gdi", "FontItalic out of bounds");
assert(false && "FontItalic out of bounds");
return stream << "unknown";
}
}
enum FontLineStyle { LINESTYLE_NONE, LINESTYLE_SINGLE, LINESTYLE_DOUBLE,
LINESTYLE_DOTTED, LINESTYLE_DONTKNOW,
LINESTYLE_DASH, LINESTYLE_LONGDASH,
LINESTYLE_DASHDOT, LINESTYLE_DASHDOTDOT,
LINESTYLE_SMALLWAVE,
LINESTYLE_WAVE, LINESTYLE_DOUBLEWAVE,
LINESTYLE_BOLD, LINESTYLE_BOLDDOTTED,
LINESTYLE_BOLDDASH, LINESTYLE_BOLDLONGDASH,
LINESTYLE_BOLDDASHDOT, LINESTYLE_BOLDDASHDOTDOT,
LINESTYLE_BOLDWAVE,
FontLineStyle_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontLineStyle const& linestyle)
{
switch (linestyle)
{
case LINESTYLE_NONE:
return stream << "none";
case LINESTYLE_SINGLE:
return stream << "single";
case LINESTYLE_DOUBLE:
return stream << "double";
case LINESTYLE_DOTTED:
return stream << "dotted";
case LINESTYLE_DONTKNOW:
return stream << "unknown";
case LINESTYLE_DASH:
return stream << "dash";
case LINESTYLE_LONGDASH:
return stream << "long dash";
case LINESTYLE_DASHDOT:
return stream << "dash dot";
case LINESTYLE_DASHDOTDOT:
return stream << "dash dot dot";
case LINESTYLE_SMALLWAVE:
return stream << "small wave";
case LINESTYLE_WAVE:
return stream << "wave";
case LINESTYLE_DOUBLEWAVE:
return stream << "double wave";
case LINESTYLE_BOLD:
return stream << "bold";
case LINESTYLE_BOLDDOTTED:
return stream << "bold dotted";
case LINESTYLE_BOLDDASH:
return stream << "bold dash";
case LINESTYLE_BOLDLONGDASH:
return stream << "bold long dash";
case LINESTYLE_BOLDDASHDOT:
return stream << "bold dash dot";
case LINESTYLE_BOLDDASHDOTDOT:
return stream << "bold dash dot dot";
case LINESTYLE_BOLDWAVE:
return stream << "bold wave";
default:
SAL_WARN("vcl.gdi", "FontLineStyle out of bounds");
assert(false && "FontLineStyle out of bounds");
return stream << "unknown";
}
}
enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE,
STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD,
STRIKEOUT_SLASH, STRIKEOUT_X,
FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontStrikeout const& strikeout)
{
switch (strikeout)
{
case STRIKEOUT_NONE:
return stream << "none";
case STRIKEOUT_SINGLE:
return stream << "single";
case STRIKEOUT_DOUBLE:
return stream << "double";
case STRIKEOUT_DONTKNOW:
return stream << "unknown";
case STRIKEOUT_BOLD:
return stream << "bold";
case STRIKEOUT_SLASH:
return stream << "slash";
case STRIKEOUT_X:
return stream << "x";
default:
SAL_WARN("vcl.gdi", "FontStrikeout out of bounds");
assert(false && "FontStrikeout out of bounds");
return stream << "unknown";
}
}
enum class FontEmphasisMark {
NONE = 0x0000, // capitalisation to avoid conflict with X11 macro
Dot = 0x0001,
Circle = 0x0002,
Disc = 0x0003,
Accent = 0x0004,
Style = 0x000f,
PosAbove = 0x1000,
PosBelow = 0x2000
};
namespace o3tl
{
template<> struct typed_flags<FontEmphasisMark> : is_typed_flags<FontEmphasisMark, 0x300f> {};
}
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontEmphasisMark const& emphasismark)
{
switch (emphasismark)
{
case FontEmphasisMark::NONE:
return stream << "none";
case FontEmphasisMark::Dot:
return stream << "Dot";
case FontEmphasisMark::Circle:
return stream << "Circle";
case FontEmphasisMark::Disc:
return stream << "Disc";
case FontEmphasisMark::Accent:
return stream << "Accent";
case FontEmphasisMark::Style:
return stream << "Style";
case FontEmphasisMark::PosAbove:
return stream << "PosAbove";
case FontEmphasisMark::PosBelow:
return stream << "PosBelow";
default:
SAL_WARN("vcl.gdi", "FontEmphasisMark out of bounds");
assert(false && "FontEmphasisMark out of bounds");
return stream << "unknown";
}
}
enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontEmbeddedBitmap const& embeddedbitmap)
{
switch (embeddedbitmap)
{
case EMBEDDEDBITMAP_DONTKNOW:
return stream << "unknown";
case EMBEDDEDBITMAP_FALSE:
return stream << "false";
case EMBEDDEDBITMAP_TRUE:
return stream << "true";
}
return stream << "unknown";
}
enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE };
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, FontAntiAlias const& antialias)
{
switch (antialias)
{
case ANTIALIAS_DONTKNOW:
return stream << "unknown";
case ANTIALIAS_FALSE:
return stream << "false";
case ANTIALIAS_TRUE:
return stream << "true";
}
return stream << "unknown";
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|