1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_TOOLS_FONTENUM_HXX
20 #define INCLUDED_TOOLS_FONTENUM_HXX
22 #include <sal/types.h>
23 #include <sal/log.hxx>
24 #include <o3tl/typed_flags_set.hxx>
28 enum FontFamily
{ FAMILY_DONTKNOW
, FAMILY_DECORATIVE
, FAMILY_MODERN
,
29 FAMILY_ROMAN
, FAMILY_SCRIPT
, FAMILY_SWISS
, FAMILY_SYSTEM
, FontFamily_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
31 template< typename charT
, typename traits
>
32 inline std::basic_ostream
<charT
, traits
> & operator <<(
33 std::basic_ostream
<charT
, traits
> & stream
, FontFamily
const& family
)
38 return stream
<< "unknown";
40 case FAMILY_DECORATIVE
:
41 return stream
<< "decorative";
44 return stream
<< "modern";
47 return stream
<< "roman";
50 return stream
<< "script";
53 return stream
<< "swiss";
56 return stream
<< "system";
59 SAL_WARN("vcl.gdi", "FontFamily out of bounds");
60 assert(false && "FontFamily out of bounds");
61 return stream
<< "unknown";
65 enum FontPitch
{ PITCH_DONTKNOW
, PITCH_FIXED
, PITCH_VARIABLE
, FontPitch_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
67 template< typename charT
, typename traits
>
68 inline std::basic_ostream
<charT
, traits
> & operator <<(
69 std::basic_ostream
<charT
, traits
> & stream
, FontPitch
const& pitch
)
74 return stream
<< "unknown";
77 return stream
<< "fixed";
80 return stream
<< "variable";
83 SAL_WARN("vcl.gdi", "FontPitch out of bounds");
84 assert(false && "FontPitch out of bounds");
85 return stream
<< "unknown";
89 enum TextAlign
{ ALIGN_TOP
, ALIGN_BASELINE
, ALIGN_BOTTOM
, TextAlign_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
91 template< typename charT
, typename traits
>
92 inline std::basic_ostream
<charT
, traits
> & operator <<(
93 std::basic_ostream
<charT
, traits
> & stream
, TextAlign
const& align
)
98 return stream
<< "top";
101 return stream
<< "baseline";
104 return stream
<< "bottom";
107 SAL_WARN("vcl.gdi", "TextAlign out of bounds");
108 assert(false && "TextAlign out of bounds");
109 return stream
<< "unknown";
113 enum FontWeight
{ WEIGHT_DONTKNOW
, WEIGHT_THIN
, WEIGHT_ULTRALIGHT
,
114 WEIGHT_LIGHT
, WEIGHT_SEMILIGHT
, WEIGHT_NORMAL
,
115 WEIGHT_MEDIUM
, WEIGHT_SEMIBOLD
, WEIGHT_BOLD
,
116 WEIGHT_ULTRABOLD
, WEIGHT_BLACK
, FontWeight_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
118 template< typename charT
, typename traits
>
119 inline std::basic_ostream
<charT
, traits
> & operator <<(
120 std::basic_ostream
<charT
, traits
> & stream
, FontWeight
const& weight
)
124 case WEIGHT_DONTKNOW
:
125 return stream
<< "unknown";
128 return stream
<< "thin";
130 case WEIGHT_ULTRALIGHT
:
131 return stream
<< "ultralight";
134 return stream
<< "light";
136 case WEIGHT_SEMILIGHT
:
137 return stream
<< "semilight";
140 return stream
<< "normal";
143 return stream
<< "medium";
145 case WEIGHT_SEMIBOLD
:
146 return stream
<< "semibold";
149 return stream
<< "bold";
151 case WEIGHT_ULTRABOLD
:
152 return stream
<< "ultrabold";
155 return stream
<< "black";
158 SAL_WARN("vcl.gdi", "FontWeight out of bounds");
159 assert(false && "FontWeight out of bounds");
160 return stream
<< "unknown";
164 enum FontWidth
{ WIDTH_DONTKNOW
, WIDTH_ULTRA_CONDENSED
, WIDTH_EXTRA_CONDENSED
,
165 WIDTH_CONDENSED
, WIDTH_SEMI_CONDENSED
, WIDTH_NORMAL
,
166 WIDTH_SEMI_EXPANDED
, WIDTH_EXPANDED
, WIDTH_EXTRA_EXPANDED
,
167 WIDTH_ULTRA_EXPANDED
,
168 FontWidth_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
170 template< typename charT
, typename traits
>
171 inline std::basic_ostream
<charT
, traits
> & operator <<(
172 std::basic_ostream
<charT
, traits
> & stream
, FontWidth
const& width
)
177 return stream
<< "unknown";
179 case WIDTH_ULTRA_CONDENSED
:
180 return stream
<< "ultra condensed";
182 case WIDTH_EXTRA_CONDENSED
:
183 return stream
<< "extra ultra condensed";
185 case WIDTH_CONDENSED
:
186 return stream
<< "condensed";
188 case WIDTH_SEMI_CONDENSED
:
189 return stream
<< "semi condensed";
192 return stream
<< "normal";
194 case WIDTH_SEMI_EXPANDED
:
195 return stream
<< "semi expanded";
198 return stream
<< "expanded";
200 case WIDTH_EXTRA_EXPANDED
:
201 return stream
<< "extra expanded";
203 case WIDTH_ULTRA_EXPANDED
:
204 return stream
<< "ultra expanded";
207 SAL_WARN("vcl.gdi", "FontWidth out of bounds");
208 assert(false && "FontWidth out of bounds");
209 return stream
<< "unknown";
213 enum FontItalic
{ ITALIC_NONE
, ITALIC_OBLIQUE
, ITALIC_NORMAL
, ITALIC_DONTKNOW
, FontItalic_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
215 template< typename charT
, typename traits
>
216 inline std::basic_ostream
<charT
, traits
> & operator <<(
217 std::basic_ostream
<charT
, traits
> & stream
, FontItalic
const& italic
)
221 case ITALIC_DONTKNOW
:
222 return stream
<< "unknown";
225 return stream
<< "oblique";
228 return stream
<< "normal";
231 return stream
<< "none";
234 SAL_WARN("vcl.gdi", "FontItalic out of bounds");
235 assert(false && "FontItalic out of bounds");
236 return stream
<< "unknown";
240 enum FontLineStyle
{ LINESTYLE_NONE
, LINESTYLE_SINGLE
, LINESTYLE_DOUBLE
,
241 LINESTYLE_DOTTED
, LINESTYLE_DONTKNOW
,
242 LINESTYLE_DASH
, LINESTYLE_LONGDASH
,
243 LINESTYLE_DASHDOT
, LINESTYLE_DASHDOTDOT
,
245 LINESTYLE_WAVE
, LINESTYLE_DOUBLEWAVE
,
246 LINESTYLE_BOLD
, LINESTYLE_BOLDDOTTED
,
247 LINESTYLE_BOLDDASH
, LINESTYLE_BOLDLONGDASH
,
248 LINESTYLE_BOLDDASHDOT
, LINESTYLE_BOLDDASHDOTDOT
,
250 FontLineStyle_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
252 template< typename charT
, typename traits
>
253 inline std::basic_ostream
<charT
, traits
> & operator <<(
254 std::basic_ostream
<charT
, traits
> & stream
, FontLineStyle
const& linestyle
)
259 return stream
<< "none";
261 case LINESTYLE_SINGLE
:
262 return stream
<< "single";
264 case LINESTYLE_DOUBLE
:
265 return stream
<< "double";
267 case LINESTYLE_DOTTED
:
268 return stream
<< "dotted";
270 case LINESTYLE_DONTKNOW
:
271 return stream
<< "unknown";
274 return stream
<< "dash";
276 case LINESTYLE_LONGDASH
:
277 return stream
<< "long dash";
279 case LINESTYLE_DASHDOT
:
280 return stream
<< "dash dot";
282 case LINESTYLE_DASHDOTDOT
:
283 return stream
<< "dash dot dot";
285 case LINESTYLE_SMALLWAVE
:
286 return stream
<< "small wave";
289 return stream
<< "wave";
291 case LINESTYLE_DOUBLEWAVE
:
292 return stream
<< "double wave";
295 return stream
<< "bold";
297 case LINESTYLE_BOLDDOTTED
:
298 return stream
<< "bold dotted";
300 case LINESTYLE_BOLDDASH
:
301 return stream
<< "bold dash";
303 case LINESTYLE_BOLDLONGDASH
:
304 return stream
<< "bold long dash";
306 case LINESTYLE_BOLDDASHDOT
:
307 return stream
<< "bold dash dot";
309 case LINESTYLE_BOLDDASHDOTDOT
:
310 return stream
<< "bold dash dot dot";
312 case LINESTYLE_BOLDWAVE
:
313 return stream
<< "bold wave";
316 SAL_WARN("vcl.gdi", "FontLineStyle out of bounds");
317 assert(false && "FontLineStyle out of bounds");
318 return stream
<< "unknown";
322 enum FontStrikeout
{ STRIKEOUT_NONE
, STRIKEOUT_SINGLE
, STRIKEOUT_DOUBLE
,
323 STRIKEOUT_DONTKNOW
, STRIKEOUT_BOLD
,
324 STRIKEOUT_SLASH
, STRIKEOUT_X
,
325 FontStrikeout_FORCE_EQUAL_SIZE
=SAL_MAX_ENUM
};
327 template< typename charT
, typename traits
>
328 inline std::basic_ostream
<charT
, traits
> & operator <<(
329 std::basic_ostream
<charT
, traits
> & stream
, FontStrikeout
const& strikeout
)
334 return stream
<< "none";
336 case STRIKEOUT_SINGLE
:
337 return stream
<< "single";
339 case STRIKEOUT_DOUBLE
:
340 return stream
<< "double";
342 case STRIKEOUT_DONTKNOW
:
343 return stream
<< "unknown";
346 return stream
<< "bold";
348 case STRIKEOUT_SLASH
:
349 return stream
<< "slash";
352 return stream
<< "x";
355 SAL_WARN("vcl.gdi", "FontStrikeout out of bounds");
356 assert(false && "FontStrikeout out of bounds");
357 return stream
<< "unknown";
361 enum class FontEmphasisMark
{
362 NONE
= 0x0000, // capitalisation to avoid conflict with X11 macro
373 template<> struct typed_flags
<FontEmphasisMark
> : is_typed_flags
<FontEmphasisMark
, 0x300f> {};
376 template< typename charT
, typename traits
>
377 inline std::basic_ostream
<charT
, traits
> & operator <<(
378 std::basic_ostream
<charT
, traits
> & stream
, FontEmphasisMark
const& emphasismark
)
380 switch (emphasismark
)
382 case FontEmphasisMark::NONE
:
383 return stream
<< "none";
385 case FontEmphasisMark::Dot
:
386 return stream
<< "Dot";
388 case FontEmphasisMark::Circle
:
389 return stream
<< "Circle";
391 case FontEmphasisMark::Disc
:
392 return stream
<< "Disc";
394 case FontEmphasisMark::Accent
:
395 return stream
<< "Accent";
397 case FontEmphasisMark::Style
:
398 return stream
<< "Style";
400 case FontEmphasisMark::PosAbove
:
401 return stream
<< "PosAbove";
403 case FontEmphasisMark::PosBelow
:
404 return stream
<< "PosBelow";
407 SAL_WARN("vcl.gdi", "FontEmphasisMark out of bounds");
408 assert(false && "FontEmphasisMark out of bounds");
409 return stream
<< "unknown";
413 enum FontEmbeddedBitmap
{ EMBEDDEDBITMAP_DONTKNOW
, EMBEDDEDBITMAP_FALSE
, EMBEDDEDBITMAP_TRUE
};
415 template< typename charT
, typename traits
>
416 inline std::basic_ostream
<charT
, traits
> & operator <<(
417 std::basic_ostream
<charT
, traits
> & stream
, FontEmbeddedBitmap
const& embeddedbitmap
)
419 switch (embeddedbitmap
)
421 case EMBEDDEDBITMAP_DONTKNOW
:
422 return stream
<< "unknown";
424 case EMBEDDEDBITMAP_FALSE
:
425 return stream
<< "false";
427 case EMBEDDEDBITMAP_TRUE
:
428 return stream
<< "true";
431 return stream
<< "unknown";
434 enum FontAntiAlias
{ ANTIALIAS_DONTKNOW
, ANTIALIAS_FALSE
, ANTIALIAS_TRUE
};
436 template< typename charT
, typename traits
>
437 inline std::basic_ostream
<charT
, traits
> & operator <<(
438 std::basic_ostream
<charT
, traits
> & stream
, FontAntiAlias
const& antialias
)
442 case ANTIALIAS_DONTKNOW
:
443 return stream
<< "unknown";
445 case ANTIALIAS_FALSE
:
446 return stream
<< "false";
449 return stream
<< "true";
452 return stream
<< "unknown";
457 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */