/src/libwps/src/lib/WPSFont.h
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
2 | | /* libwps |
3 | | * Version: MPL 2.0 / LGPLv2.1+ |
4 | | * |
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/. |
8 | | * |
9 | | * Major Contributor(s): |
10 | | * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr) |
11 | | * Copyright (C) 2006, 2007 Andrew Ziem |
12 | | * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch) |
13 | | * Copyright (C) 2004 Marc Maurer (uwog@uwog.net) |
14 | | * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca) |
15 | | * |
16 | | * For minor contributions see the git repository. |
17 | | * |
18 | | * Alternatively, the contents of this file may be used under the terms |
19 | | * of the GNU Lesser General Public License Version 2.1 or later |
20 | | * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are |
21 | | * applicable instead of those above. |
22 | | * |
23 | | * For further information visit http://libwps.sourceforge.net |
24 | | */ |
25 | | |
26 | | #ifndef WPS_FONT |
27 | | # define WPS_FONT |
28 | | |
29 | | #include <iostream> |
30 | | |
31 | | #include <string> |
32 | | |
33 | | #include "libwps_internal.h" |
34 | | |
35 | | /** define the font properties */ |
36 | | class WPSFont |
37 | | { |
38 | | public: |
39 | | //! constructor |
40 | | WPSFont() |
41 | 45.0M | : m_name("") |
42 | 45.0M | , m_size(0) |
43 | 45.0M | , m_attributes(0) |
44 | 45.0M | , m_spacing(0) |
45 | 45.0M | , m_color(WPSColor::black()) |
46 | 45.0M | , m_languageId(-1) |
47 | 45.0M | , m_extra("") {} |
48 | 31.8M | WPSFont(WPSFont const &)=default; |
49 | 64.1k | WPSFont(WPSFont &&)=default; |
50 | 9.58M | WPSFont &operator=(WPSFont const &)=default; |
51 | 560k | WPSFont &operator=(WPSFont &&)=default; |
52 | | //! returns the default font ( Courier 12pt) |
53 | | static WPSFont getDefault() |
54 | 2.91k | { |
55 | 2.91k | WPSFont res; |
56 | 2.91k | res.m_name = "Courier"; |
57 | 2.91k | res.m_size = 12; |
58 | 2.91k | return res; |
59 | 2.91k | } |
60 | | //! destructor |
61 | | virtual ~WPSFont(); |
62 | | //! operator<< |
63 | | friend std::ostream &operator<<(std::ostream &o, WPSFont const &ft); |
64 | | |
65 | | //! add to the propList |
66 | | void addTo(librevenge::RVNGPropertyList &propList) const; |
67 | | |
68 | | //! accessor |
69 | | bool isSet() const |
70 | 0 | { |
71 | 0 | return !m_name.empty(); |
72 | 0 | } |
73 | | |
74 | | //! operator== |
75 | | bool operator==(WPSFont const &ft) const; |
76 | | //! operator!= |
77 | | bool operator!=(WPSFont const &ft) const |
78 | 2.69M | { |
79 | 2.69M | return !operator==(ft); |
80 | 2.69M | } |
81 | | |
82 | | //! font name |
83 | | librevenge::RVNGString m_name; |
84 | | //! font size |
85 | | double m_size; |
86 | | //! the font attributes defined as a set of bits |
87 | | uint32_t m_attributes; |
88 | | //! font spacing |
89 | | double m_spacing; |
90 | | //! the font color |
91 | | WPSColor m_color; |
92 | | //! the language (simplified locale name id) if known |
93 | | int m_languageId; |
94 | | |
95 | | //! public field use to add a message when the font is printed |
96 | | std::string m_extra; |
97 | | }; |
98 | | |
99 | | #endif |
100 | | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |