My Project
qfont.h
1 #pragma once
2 #include "SpriteFontEntity.h"
3 
4 namespace ParaEngine
5 {
6  class CPaintDevice;
7 
8  class QFont
9  {
10  public:
11  enum StyleHint {
12  Helvetica, SansSerif = Helvetica,
13  Times, Serif = Times,
14  Courier, TypeWriter = Courier,
15  OldEnglish, Decorative = OldEnglish,
16  System,
17  AnyStyle,
18  Cursive,
19  Monospace,
20  Fantasy
21  };
22 
23  enum Weight {
24  Light = 25,
25  Normal = 50,
26  DemiBold = 63,
27  Bold = 75,
28  Black = 87
29  };
30 
31  enum Style {
32  StyleNormal,
33  StyleItalic,
34  StyleOblique
35  };
36 
37  QFont();
38  QFont(const std::string &family, int pointSize = -1, int weight = -1, bool italic = false);
39  ~QFont();
40 
41 
42  std::string family() const;
43  void setFamily(const std::string &);
44 
45  int pointSize() const;
46  void setPointSize(int);
47  inline float pointSizeF() const;
48  inline void setPointSizeF(float fSize);
49 
50  int weight() const;
51  void setWeight(int);
52 
53  void setStyle(Style style);
54  Style style() const;
55 
56  inline bool bold() const;
57  inline void setBold(bool);
58  inline bool italic() const;
59  inline void setItalic(bool b);
60 
61  bool operator==(const QFont & r) const;
62  inline bool operator!=(const QFont & r) const {
63  return !operator == (r);
64  };
65 
66  std::string key() const;
67 
68  std::string toString() const;
69  bool fromString(const std::string &);
70 
71  std::string defaultFamily() const;
72 
73  SpriteFontEntity* GetSpriteFont();
74  private:
76  void SetDirty();
77  private:
78  asset_ptr<SpriteFontEntity> m_pFontSprite;
79  std::string m_family;
80  int m_pointSize;
81  Style m_style;
82  // type of Weight
83  int32 m_weight;
84  };
85 
86  inline bool QFont::bold() const
87  {
88  return weight() > Normal;
89  }
90 
91  inline void QFont::setBold(bool enable)
92  {
93  setWeight(enable ? Bold : Normal);
94  }
95 
96  inline bool QFont::italic() const
97  {
98  return (style() != StyleNormal);
99  }
100 
101  inline void QFont::setItalic(bool b) {
102  setStyle(b ? StyleItalic : StyleNormal);
103  }
104 
105  inline float QFont::pointSizeF() const { return (float)pointSize(); };
106  inline void QFont::setPointSizeF(float fSize) { setPointSize((int)fSize); };
107 }
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: qfont.h:8
Definition: SpriteFontEntity.h:26