All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FontInstance.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Fonts.h"
7 #include "AsyncTexturing.h"
8 #include <vector>
9 #include <string>
10 
11 namespace Eegeo
12 {
13  namespace Fonts
14  {
16  {
17  public:
19  const std::string& fontInstanceId,
20  float outlineThickness,
21  float height,
22  float base,
23  float lineHeight,
24  float meanLine,
25  float scaleW,
26  float scaleH,
27  const std::vector<std::string>& textureNames,
28  FontCharacterTable* characterTable,
29  FontKerningTable* kerningTable,
30  bool isSdf,
31  float sdfSpread);
32 
33  ~FontInstance();
34 
35  const std::string& GetId() const { return m_fontInstanceId; }
36  float GetBase() const { return m_base; }
37  float GetLineHeight() const { return m_lineHeight; }
38  float GetMeanLine() const { return m_meanLine; }
39  float GetHeight() const { return m_height; }
40  int GetNumPages() const { return static_cast<int>(m_textureList.size()); }
41  float GetOutlineThickness() const { return m_outlineThickness; }
42  float GetScaleW() const { return m_scaleW; }
43  float GetScaleH() const { return m_scaleH; }
44  bool IsSdf() const { return m_isSdf; }
45  float GetSdfSpread() const { return m_sdfSpread; }
46 
47  const std::vector<Rendering::AsyncTexturing::IAsyncTexture*>& GetTextureList() const { return m_textureList; }
48 
49  const FontCharacter& GetCharacter(u32 charUnicode) const;
50  const FontCharacter& GetCharacterOrDefault(u32 charUnicode) const;
51  bool ContainsCharacter(u32 charUnicode) const;
52  float GetKerning(u32 firstUnicode, u32 secondUnicode) const;
53 
54  private:
55  void LoadFontPageTextures(
57  const std::vector<std::string>& textureNames
58  );
59 
60  const std::string m_fontInstanceId;
61  float m_outlineThickness;
62  float m_height;
63  float m_base;
64  float m_lineHeight;
65  float m_meanLine;
66  float m_scaleW;
67  float m_scaleH;
68  bool m_isSdf;
69  float m_sdfSpread;
70 
71  std::vector<Rendering::AsyncTexturing::IAsyncTexture*> m_textureList;
72  FontCharacterTable* m_characterTable;
73  FontKerningTable* m_kerningTable;
74  };
75  }
76 }