ASPiK SDK
cfont.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __cfont__
6 #define __cfont__
7 
8 #include "vstguifwd.h"
9 #include "cstring.h"
10 #include <string>
11 #include <list>
12 
13 namespace VSTGUI {
14 
15 //-----------
16 // @brief Text Face
17 //-----------
18 enum CTxtFace
19 {
20  kNormalFace = 0,
21  kBoldFace = 1 << 1,
22  kItalicFace = 1 << 2,
23  kUnderlineFace = 1 << 3,
24  kStrikethroughFace = 1 << 4
25 };
26 
27 //-----------------------------------------------------------------------------
28 // CFontDesc Declaration
30 //-----------------------------------------------------------------------------
32 {
33 public:
35 
36  CFontDesc (const UTF8String& name = "", const CCoord& size = 0, const int32_t style = 0);
37  CFontDesc (const CFontDesc& font);
38  ~CFontDesc () noexcept override = default;
39 
40  //-----------------------------------------------------------------------------
42  //-----------------------------------------------------------------------------
44  const UTF8String& getName () const { return name; }
45  const CCoord& getSize () const { return size; }
46  const int32_t& getStyle () const { return style; }
47 
48  virtual void setName (const UTF8String& newName);
49  virtual void setSize (CCoord newSize);
50  virtual void setStyle (int32_t newStyle);
51 
52 
53  virtual const PlatformFontPtr getPlatformFont () const;
54  virtual const IFontPainter* getFontPainter () const;
55 
56  virtual CFontDesc& operator= (const CFontDesc&);
57  virtual bool operator== (const CFontDesc&) const;
58  virtual bool operator!= (const CFontDesc& other) const { return !(*this == other);}
59 
60  static void cleanup ();
61 
62 protected:
63  void beforeDelete () override;
64  virtual void freePlatformFont ();
65 
66  UTF8String name;
67  CCoord size;
68  int32_t style;
69  mutable PlatformFontPtr platformFont;
70 };
71 
72 using CFontRef = CFontDesc*;
73 
74 //-----------------------------------------------------------------------------
75 // Global fonts
76 //-----------------------------------------------------------------------------
77 extern const CFontRef kSystemFont;
78 extern const CFontRef kNormalFontVeryBig;
79 extern const CFontRef kNormalFontBig;
80 extern const CFontRef kNormalFont;
81 extern const CFontRef kNormalFontSmall;
82 extern const CFontRef kNormalFontSmaller;
83 extern const CFontRef kNormalFontVerySmall;
84 extern const CFontRef kSymbolFont;
85 
86 } // namespace
87 
88 #endif
virtual void setStyle(int32_t newStyle)
set the style of the font
Definition: cfont.cpp:137
font class
Definition: cfont.h:31
const UTF8String & getName() const
get the name of the font
Definition: cfont.h:44
Definition: customcontrols.cpp:8
const CCoord & getSize() const
get the height of the font
Definition: cfont.h:45
virtual void setName(const UTF8String &newName)
set the name of the font
Definition: cfont.cpp:120
virtual void setSize(CCoord newSize)
set the height of the font
Definition: cfont.cpp:130
Definition: vstguibase.h:247
font paint interface
Definition: iplatformfont.h:17
holds an UTF8 encoded string and a platform representation of it
Definition: cstring.h:56
const int32_t & getStyle() const
get the style of the font
Definition: cfont.h:46