/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: Font style atlas * Author: * Create: 2019-08-22 */ #ifndef FONT_STYLE_ATLAS_H #define FONT_STYLE_ATLAS_H #include "Common.h" #include #include namespace dolgles { class FontStyleAtlas { public: FontStyleAtlas(); ~FontStyleAtlas(); EGL_S32 GetFontTexture(const GLTextInfo &textInfo, GLuint &styleTex); EGL_S32 LoadFontByPath(const std::string &fontLibPath); const std::map &GetGlyphs() const; void GetFontGlyphs(const GLTextInfo &textInfo, std::map &glyphsMap) const; GLuint GetFontTextureWidth() const; GLuint GetFontTextureHeight() const; private: void SetFontStyleAtlas(const GLTextInfo &textInfo, FT_Face face) const; EGL_S32 CreateStyleTex(); EGL_S32 CalculateTexSize(const GLTextInfo &textInfo); void FontCharInfoToMap(FT_GlyphSlot glyph, int offsetX, int offsetY, FT_ULong charcode); void FontToTexture(const GLTextInfo &textInfo); void DeleteTexture(); FT_Face fontFaceForTextSize; FT_Face fontFace; FT_Library library; GLuint texture; GLuint texWidth; GLuint texHeight; std::map glyphs; }; }; // namespace dolgles #endif // end FONT_STYLE_ATLAS_H