/* * 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 #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 &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 glyphs; }; }; // namespace dolgles #endif // end FONT_ATLAS_H