mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14914 from steerlink/font_family
Add ability to get the font family
This commit is contained in:
commit
e1e87c0205
|
@ -274,6 +274,14 @@ int FontFreeType::getFontAscender() const
|
||||||
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* FontFreeType::getFontFamily() const
|
||||||
|
{
|
||||||
|
if (!_fontRef)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return _fontRef->family_name;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance)
|
unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance)
|
||||||
{
|
{
|
||||||
bool invalidChar = true;
|
bool invalidChar = true;
|
||||||
|
@ -639,7 +647,7 @@ void FontFreeType::releaseFont(const std::string &fontName)
|
||||||
auto item = s_cacheFontData.begin();
|
auto item = s_cacheFontData.begin();
|
||||||
while (s_cacheFontData.end() != item)
|
while (s_cacheFontData.end() != item)
|
||||||
{
|
{
|
||||||
if (item->first.find(fontName) >= 0)
|
if (item->first.find(fontName) != std::string::npos)
|
||||||
item = s_cacheFontData.erase(item);
|
item = s_cacheFontData.erase(item);
|
||||||
else
|
else
|
||||||
item++;
|
item++;
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
unsigned char* getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
unsigned char* getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
||||||
|
|
||||||
int getFontAscender() const;
|
int getFontAscender() const;
|
||||||
|
const char* getFontFamily() const;
|
||||||
|
|
||||||
virtual FontAtlas* createFontAtlas() override;
|
virtual FontAtlas* createFontAtlas() override;
|
||||||
virtual int getFontMaxHeight() const override { return _lineHeight; }
|
virtual int getFontMaxHeight() const override { return _lineHeight; }
|
||||||
|
|
Loading…
Reference in New Issue