2020-08-04 12:31:33 +08:00
|
|
|
#ifndef __BITMAPFONT_H__
|
|
|
|
#define __BITMAPFONT_H__
|
|
|
|
|
|
|
|
#include "FairyGUIMacros.h"
|
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "PackageItem.h"
|
|
|
|
|
|
|
|
NS_FGUI_BEGIN
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
class BitmapFont : public axis::Font
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
BitmapFont();
|
|
|
|
virtual ~BitmapFont();
|
|
|
|
|
|
|
|
static BitmapFont* create();
|
|
|
|
|
|
|
|
virtual int* getHorizontalKerningForTextUTF32(const std::u32string& text, int &outNumLetters) const override;
|
2022-07-08 14:20:41 +08:00
|
|
|
# if defined(AXIS_VERSION)
|
2022-07-11 17:50:21 +08:00
|
|
|
virtual axis::FontAtlas* newFontAtlas() override { return new axis::FontAtlas(this); }
|
2021-11-11 18:04:38 +08:00
|
|
|
#else
|
2022-07-11 17:50:21 +08:00
|
|
|
virtual axis::FontAtlas* createFontAtlas() override { return new axis::FontAtlas(*this); }
|
2021-11-11 18:04:38 +08:00
|
|
|
#endif
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::FontAtlas* resetFontAtlas(axis::FontAtlas* fontAtlas)
|
2021-11-11 18:04:38 +08:00
|
|
|
{
|
|
|
|
if (_fontAtlas != fontAtlas)
|
|
|
|
{
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_RELEASE(_fontAtlas);
|
2021-11-11 18:04:38 +08:00
|
|
|
_fontAtlas = fontAtlas;
|
|
|
|
}
|
|
|
|
return _fontAtlas;
|
|
|
|
}
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::FontAtlas* getFontAtlas() const { return _fontAtlas; }
|
2021-11-11 18:04:38 +08:00
|
|
|
void releaseAtlas() { resetFontAtlas(nullptr); }
|
2020-08-04 12:31:33 +08:00
|
|
|
void setFontSize(float fontSize) {}
|
|
|
|
int getOriginalFontSize()const { return _originalFontSize; }
|
|
|
|
bool isResizable() { return _resizable; }
|
|
|
|
bool canTint() { return _canTint; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
float _originalFontSize;
|
|
|
|
bool _resizable;
|
|
|
|
bool _canTint;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::FontAtlas* _fontAtlas;
|
2020-08-04 12:31:33 +08:00
|
|
|
|
|
|
|
friend class UIPackage;
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_FGUI_END
|
|
|
|
|
|
|
|
#endif
|