WPSFont.h Source File documentation

WPSFont.h
Go to the documentation of this file.
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
36 class WPSFont
37 {
38 public:
40 WPSFont()
41 : m_name("")
42 , m_size(0)
43 , m_attributes(0)
44 , m_spacing(0)
45 , m_color(WPSColor::black())
46 , m_languageId(-1)
47 , m_extra("") {}
48 WPSFont(WPSFont const &)=default;
49 WPSFont(WPSFont &&)=default;
50 WPSFont &operator=(WPSFont const &)=default;
51 WPSFont &operator=(WPSFont &&)=default;
53 static WPSFont getDefault()
54 {
55 WPSFont res;
56 res.m_name = "Courier";
57 res.m_size = 12;
58 return res;
59 }
61 virtual ~WPSFont();
63 friend std::ostream &operator<<(std::ostream &o, WPSFont const &ft);
64
66 void addTo(librevenge::RVNGPropertyList &propList) const;
67
69 bool isSet() const
70 {
71 return !m_name.empty();
72 }
73
75 bool operator==(WPSFont const &ft) const;
77 bool operator!=(WPSFont const &ft) const
78 {
79 return !operator==(ft);
80 }
81
83 librevenge::RVNGString m_name;
85 double m_size;
87 uint32_t m_attributes;
89 double m_spacing;
91 WPSColor m_color;
93 int m_languageId;
94
96 std::string m_extra;
97 };
98
99 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSFont::m_extra
std::string m_extra
public field use to add a message when the font is printed
Definition: WPSFont.h:96
WPS_STRIKEOUT_BIT
#define WPS_STRIKEOUT_BIT
Definition: libwps_internal.h:507
WPS_BOLD_BIT
#define WPS_BOLD_BIT
Definition: libwps_internal.h:506
libwps_tools_win::Language::addLocaleName
void addLocaleName(long id, librevenge::RVNGPropertyList &propList)
add locale name (ie. fo:language,fo:country ) to propList
Definition: libwps_tools_win.cpp:7510
WPSFont::isSet
bool isSet() const
accessor
Definition: WPSFont.h:69
WPS_SUBSCRIPT_BIT
#define WPS_SUBSCRIPT_BIT
Definition: libwps_internal.h:500
WPS_OVERLINE_BIT
#define WPS_OVERLINE_BIT
Definition: libwps_internal.h:515
WPS_UNDERLINE_BIT
#define WPS_UNDERLINE_BIT
Definition: libwps_internal.h:508
WPS_SUPERSCRIPT_BIT
#define WPS_SUPERSCRIPT_BIT
Definition: libwps_internal.h:499
WPS_ALL_CAPS_BIT
#define WPS_ALL_CAPS_BIT
Definition: libwps_internal.h:512
WPS_BLINK_BIT
#define WPS_BLINK_BIT
Definition: libwps_internal.h:510
WPSFont::operator=
WPSFont & operator=(WPSFont &&)=default
operator<<
std::ostream & operator<<(std::ostream &o, WPSFont const &ft)
Definition: WPSFont.cpp:34
WPS_OUTLINE_BIT
#define WPS_OUTLINE_BIT
Definition: libwps_internal.h:501
WPSFont::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSFont const &ft)
operator<<
Definition: WPSFont.cpp:34
WPS_DOUBLE_UNDERLINE_BIT
#define WPS_DOUBLE_UNDERLINE_BIT
Definition: libwps_internal.h:505
WPSFont::m_languageId
int m_languageId
the language (simplified locale name id) if known
Definition: WPSFont.h:93
WPSFont
define the font properties
Definition: WPSFont.h:37
WPS_ITALICS_BIT
#define WPS_ITALICS_BIT
Definition: libwps_internal.h:502
WPSFont::WPSFont
WPSFont(WPSFont const &)=default
WPS_SMALL_CAPS_BIT
#define WPS_SMALL_CAPS_BIT
Definition: libwps_internal.h:509
WPS_SMALL_PRINT_BIT
#define WPS_SMALL_PRINT_BIT
Definition: libwps_internal.h:497
WPSFont::WPSFont
WPSFont(WPSFont &&)=default
WPS_LARGE_BIT
#define WPS_LARGE_BIT
Definition: libwps_internal.h:496
WPSFont::operator==
bool operator==(WPSFont const &ft) const
operator==
Definition: WPSFont.cpp:73
WPSFont::m_color
WPSColor m_color
the font color
Definition: WPSFont.h:91
WPSFont::WPSFont
WPSFont()
constructor
Definition: WPSFont.h:40
WPSFont.h
WPSFont::m_attributes
uint32_t m_attributes
the font attributes defined as a set of bits
Definition: WPSFont.h:87
WPSFont::m_spacing
double m_spacing
font spacing
Definition: WPSFont.h:89
WPS_HIDDEN_BIT
#define WPS_HIDDEN_BIT
Definition: libwps_internal.h:516
WPSFont::m_size
double m_size
font size
Definition: WPSFont.h:85
WPSFont::operator!=
bool operator!=(WPSFont const &ft) const
operator!=
Definition: WPSFont.h:77
libwps_tools_win.h
WPSFont::~WPSFont
virtual ~WPSFont()
destructor
Definition: WPSFont.cpp:69
WPS_EMBOSS_BIT
#define WPS_EMBOSS_BIT
Definition: libwps_internal.h:513
WPSFont::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add to the propList
Definition: WPSFont.cpp:85
WPSFont::operator=
WPSFont & operator=(WPSFont const &)=default
WPSFont::getDefault
static WPSFont getDefault()
returns the default font ( Courier 12pt)
Definition: WPSFont.h:53
libwps_internal.h
WPSColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libwps_internal.cpp:413
WPSColor
the class to store a color
Definition: libwps_internal.h:281
WPS_SHADOW_BIT
#define WPS_SHADOW_BIT
Definition: libwps_internal.h:503
WPS_ENGRAVE_BIT
#define WPS_ENGRAVE_BIT
Definition: libwps_internal.h:514
WPSListener.h
WPSColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:345
WPSFont::m_name
librevenge::RVNGString m_name
font name
Definition: WPSFont.h:83