mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05:38 +00:00
Cleaned up some font-related code.
This commit is contained in:
parent
12f25c2618
commit
6126016289
File diff suppressed because it is too large
Load diff
|
@ -50,6 +50,7 @@ class Font : public IReloadable
|
||||||
public:
|
public:
|
||||||
virtual ~Font();
|
virtual ~Font();
|
||||||
static void initLibrary();
|
static void initLibrary();
|
||||||
|
std::vector<std::string> getFallbackFontPaths();
|
||||||
static std::shared_ptr<Font> get(int size, const std::string& path = getDefaultPath());
|
static std::shared_ptr<Font> get(int size, const std::string& path = getDefaultPath());
|
||||||
|
|
||||||
// Returns the expected size of a string when rendered. Extra spacing is applied to the Y axis.
|
// Returns the expected size of a string when rendered. Extra spacing is applied to the Y axis.
|
||||||
|
@ -149,8 +150,6 @@ private:
|
||||||
void rebuildTextures();
|
void rebuildTextures();
|
||||||
void unloadTextures();
|
void unloadTextures();
|
||||||
|
|
||||||
std::vector<FontTexture> mTextures;
|
|
||||||
|
|
||||||
void getTextureForNewGlyph(const glm::ivec2& glyphSize,
|
void getTextureForNewGlyph(const glm::ivec2& glyphSize,
|
||||||
FontTexture*& tex_out,
|
FontTexture*& tex_out,
|
||||||
glm::ivec2& cursor_out);
|
glm::ivec2& cursor_out);
|
||||||
|
@ -169,13 +168,12 @@ private:
|
||||||
glm::vec2 bearing;
|
glm::vec2 bearing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector<FontTexture> mTextures;
|
||||||
std::map<unsigned int, Glyph> mGlyphMap;
|
std::map<unsigned int, Glyph> mGlyphMap;
|
||||||
|
|
||||||
Glyph* getGlyph(const unsigned int id);
|
Glyph* getGlyph(const unsigned int id);
|
||||||
|
|
||||||
int mMaxGlyphHeight;
|
|
||||||
|
|
||||||
int mSize;
|
int mSize;
|
||||||
|
int mMaxGlyphHeight;
|
||||||
const std::string mPath;
|
const std::string mPath;
|
||||||
|
|
||||||
float getNewlineStartOffset(const std::string& text,
|
float getNewlineStartOffset(const std::string& text,
|
||||||
|
@ -194,16 +192,6 @@ private:
|
||||||
// Font holds the OpenGL texture), and if a Font changes your TextCache may become invalid.
|
// Font holds the OpenGL texture), and if a Font changes your TextCache may become invalid.
|
||||||
class TextCache
|
class TextCache
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
struct VertexList {
|
|
||||||
std::vector<Renderer::Vertex> verts;
|
|
||||||
// This is a pointer because the texture ID can change during
|
|
||||||
// deinit/reinit (when launching a game).
|
|
||||||
unsigned int* textureIdPtr;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<VertexList> vertexLists;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct CacheMetrics {
|
struct CacheMetrics {
|
||||||
glm::vec2 size;
|
glm::vec2 size;
|
||||||
|
@ -214,6 +202,16 @@ public:
|
||||||
void setDimming(float dimming);
|
void setDimming(float dimming);
|
||||||
|
|
||||||
friend Font;
|
friend Font;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
struct VertexList {
|
||||||
|
std::vector<Renderer::Vertex> verts;
|
||||||
|
// This is a pointer because the texture ID can change during
|
||||||
|
// deinit/reinit (when launching a game).
|
||||||
|
unsigned int* textureIdPtr;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<VertexList> vertexLists;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ES_CORE_RESOURCES_FONT_H
|
#endif // ES_CORE_RESOURCES_FONT_H
|
||||||
|
|
Loading…
Reference in a new issue