More text changes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "Asset.h"
|
||||
#include "Containers/Map.h"
|
||||
#include "Graphics/Texture.h"
|
||||
#include "Math/Math.h"
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_NAME_REF(Gfx, Texture2D)
|
||||
class FontAsset : public Asset {
|
||||
public:
|
||||
static constexpr uint64 IDENTIFIER = 0x10;
|
||||
@@ -24,10 +24,27 @@ class FontAsset : public Asset {
|
||||
void save(ArchiveBuffer& buffer) const;
|
||||
void load(ArchiveBuffer& buffer);
|
||||
};
|
||||
const Glyph& getGlyphData(char c) const { return glyphs[c]; }
|
||||
struct FontData {
|
||||
int32 ascent;
|
||||
int32 descent;
|
||||
int32 linegap;
|
||||
Map<uint32, Glyph> glyphs;
|
||||
};
|
||||
const Glyph& getGlyphData(char c, uint32 fontSize) {
|
||||
if (!fontSizes.contains(fontSize))
|
||||
loadFontSize(fontSize);
|
||||
return fontSizes[fontSize].glyphs[c];
|
||||
}
|
||||
const FontData& getFontData(uint32 fontSize) { return fontSizes[fontSize]; }
|
||||
void loadFace();
|
||||
|
||||
private:
|
||||
Map<uint32, Glyph> glyphs;
|
||||
void loadFontSize(uint32 fontSize);
|
||||
Gfx::PGraphics graphics;
|
||||
FT_Library ft;
|
||||
FT_Face face;
|
||||
Array<uint8> ttfFile;
|
||||
Map<uint32, FontData> fontSizes;
|
||||
friend class FontLoader;
|
||||
};
|
||||
DECLARE_REF(FontAsset)
|
||||
|
||||
Reference in New Issue
Block a user