OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Font.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
10#include "OTGui/GuiTypes.h"
11#include "OTCore/Serializable.h"
12
13// std header
14#include <string>
15
16#pragma warning(disable:4251)
17
18namespace ot {
19
21 public:
22 Font();
23 Font(FontFamily _fontFamily, int _sizePx = 12, bool _isBold = false, bool _isItalic = false);
24 Font(const std::string& _fontFamily, int _sizePx = 12, bool _isBold = false, bool _isItalic = false);
25 Font(const Font& _other);
26 virtual ~Font();
27
28 Font& operator = (const Font& _other);
29 bool operator == (const Font& _other) const;
30 bool operator != (const Font& _other) const;
31
35 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
36
40 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
41
42 void setFamily(const std::string& _fontFamily) { m_family = _fontFamily; };
43 void setFamily(FontFamily _fontFamily);
44 const std::string& family(void) const { return m_family; };
45
46 void setSize(int _px) { m_sizePx = _px; };
47 int size(void) const { return m_sizePx; };
48
49 void setBold(bool _isBold = true) { m_isBold = _isBold; };
50 bool isBold(void) const { return m_isBold; };
51
52 void setItalic(bool _isItalic = true) { m_isItalic = _isItalic; };
53 bool isItalic(void) const { return m_isItalic; };
54
55 private:
56 std::string m_family;
57 int m_sizePx;
58 bool m_isBold;
59 bool m_isItalic;
60 };
61
62}
bool operator==(const FaceSelection &left, const FaceSelection &right)
Definition Model.cpp:55
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition Font.h:20
void setBold(bool _isBold=true)
Definition Font.h:49
bool isBold(void) const
Definition Font.h:50
void setItalic(bool _isItalic=true)
Definition Font.h:52
void setFamily(const std::string &_fontFamily)
Definition Font.h:42
void setSize(int _px)
Definition Font.h:46
const std::string & family(void) const
Definition Font.h:44
bool isItalic(void) const
Definition Font.h:53
int size(void) const
Definition Font.h:47
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
Definition Connector.h:8
FontFamily
Generally available font families.
Definition GuiTypes.h:42
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30