VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGLFontManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
15 
16 #include <vector>
17 #include <unordered_map>
18 
19 namespace makVrv
20 {
21  class DtFont;
22 
27  {
28  public:
30  DtGLFontManager(DtDe& de, const std::string& fontPath);
31 
33  ~DtGLFontManager();
34 
36  DtGLFontManager() = delete;
38  DtGLFontManager(const DtGLFontManager& rhs) = delete;
40  DtGLFontManager& operator=(const DtGLFontManager& rhs) = delete;
41 
42  public:
44  virtual DtFontInterface* getFont(const std::string& filename, float size) override;
45 
46  //Deletes all fonts in memory.
47  virtual void clear() override;
48 
50  virtual void addTextureListForDeletion(const std::vector<unsigned int>& textures ) override;
51 
54  virtual void releaseResouces();
55 
57  virtual void flushTextureList();
58 
59  protected:
61  virtual DtFontInterface* getDefaultFont(float size);
62 
63  protected:
64  struct FontKey
65  {
66  std::string myFontFileName;
67  float myFontSize = 0;
68 
69  bool operator==(const FontKey& rhs) const;
70  };
71 
73  {
74  std::size_t operator()(const FontKey& k) const;
75  };
76 
77  std::unordered_map< FontKey, DtFont*, FontKeyHasher > myMap;
78 
79  std::vector<unsigned int> myTextures;
80 
82 
83  bool myDefaultFontExists = false;
84  std::string myDefaultFontFile;
85  };
86 }
Definition: DtGLFontManager.h:72
voidpf void uLong size
Definition: ioapi.h:39
std::unordered_map< FontKey, DtFont *, FontKeyHasher > myMap
Definition: DtGLFontManager.h:77
Manages instances of fonts, the font will be kept in memory unless the manager is cleared...
Definition: DtFontManagerInterface.h:25
Manages instances of fonts, the font will be kept in memory unless the manager is cleared...
Definition: DtGLFontManager.h:26
std::string myDefaultFontFile
Definition: DtGLFontManager.h:84
std::string myFontFileName
Definition: DtGLFontManager.h:66
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
A class with encapsulated a font loaded from disk with a given size.
Definition: DtFontInterface.h:22
std::vector< unsigned int > myTextures
Definition: DtGLFontManager.h:79
Contains makVrv::DtFontManagerInterface class.
bool operator==(const DtTextureAtlasIndexParser::StringOrFloatAttrib &lhs, const DtTextureAtlasIndexParser::StringOrFloatAttrib &rhs)
needed for search comparison code
Definition: DtTextureAtlasIndexParser.h:160
Definition: DtGLFontManager.h:64
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
DtDe & myDe
Definition: DtGLFontManager.h:81

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)