You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
4 months ago
|
/*
|
||
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
|
||
|
* Description: Font atlas
|
||
|
* Author:
|
||
|
* Create: 2019-08-09
|
||
|
*/
|
||
|
|
||
|
#ifndef FONT_ATLAS_H
|
||
|
#define FONT_ATLAS_H
|
||
|
|
||
|
#include <map>
|
||
|
#include "Common.h"
|
||
|
|
||
|
namespace dolgles {
|
||
|
class FontAtlas {
|
||
|
public:
|
||
|
FontAtlas();
|
||
|
~FontAtlas();
|
||
|
EGL_S32 LoadFontByPath(const std::string &fontLibPath, FT_UInt resolution);
|
||
|
GLuint GetFontTexture() const;
|
||
|
const std::map<unsigned long, GlyphInfo> &GetGlyphs() const;
|
||
|
GLuint GetFontTextureWidth() const;
|
||
|
GLuint GetFontTextureHeight() const;
|
||
|
private:
|
||
|
EGL_S32 CreateAtlasTex();
|
||
|
EGL_S32 CalculateTexSize(const FT_Face fontFace);
|
||
|
void FontCharInfoToMap(FT_GlyphSlot glyph, int offsetX, int offsetY, FT_ULong charcode);
|
||
|
void FontToTexture(const FT_Face fontFace);
|
||
|
EGL_S32 LoadFont(const FT_Face fontFace, FT_UInt resolution);
|
||
|
void DeleteTexture();
|
||
|
|
||
|
GLuint texture;
|
||
|
GLuint texWidth;
|
||
|
GLuint texHeight;
|
||
|
std::map<unsigned long, GlyphInfo> glyphs;
|
||
|
};
|
||
|
}; // namespace dolgles
|
||
|
|
||
|
#endif // end FONT_ATLAS_H
|