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.
46 lines
1.3 KiB
46 lines
1.3 KiB
/*
|
|
* 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 <map>
|
|
#include <freetype/ftglyph.h>
|
|
|
|
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<unsigned long, GlyphInfo> &GetGlyphs() const;
|
|
void GetFontGlyphs(const GLTextInfo &textInfo, std::map<unsigned long, GlyphInfo> &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<unsigned long, GlyphInfo> glyphs;
|
|
};
|
|
}; // namespace dolgles
|
|
|
|
#endif // end FONT_STYLE_ATLAS_H
|