MCPcopy Create free account
hub / github.com/axmolengine/axmol / setBMFontFilePath

Method setBMFontFilePath

core/2d/Label.cpp:833–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831}
832
833bool Label::setBMFontFilePath(std::string_view bmfontFilePath, float fontSize)
834{
835 FontAtlas* newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath);
836
837 if (!newAtlas)
838 {
839 reset();
840 return false;
841 }
842
843 // assign the default fontSize
844 if (std::abs(fontSize) < FLT_EPSILON)
845 {
846 FontFNT* bmFont = (FontFNT*)newAtlas->getFont();
847 if (bmFont)
848 {
849 float originalFontSize = bmFont->getOriginalFontSize();
850 _bmFontSize = originalFontSize / AX_CONTENT_SCALE_FACTOR();
851 }
852 }
853
854 if (fontSize > 0.0f)
855 {
856 _bmFontSize = fontSize;
857 }
858
859 _bmFontPath = bmfontFilePath;
860
861 _currentLabelType = LabelType::BMFONT;
862 setFontAtlas(newAtlas);
863
864 return true;
865}
866
867bool Label::setBMFontFilePath(std::string_view bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize)
868{

Callers 8

setBMFontSizeInternalMethod · 0.95
createWithBMFontMethod · 0.45
setTitleFontNameMethod · 0.45
setFontNameMethod · 0.45
setTitleFontNameMethod · 0.45
setFntFileMethod · 0.45
LabelFNTGlyphDesignerMethod · 0.45

Calls 4

getOriginalFontSizeMethod · 0.80
RectClass · 0.70
resetFunction · 0.50
absFunction · 0.50

Tested by 2

LabelFNTGlyphDesignerMethod · 0.36