| 831 | } |
| 832 | |
| 833 | bool 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 | |
| 867 | bool Label::setBMFontFilePath(std::string_view bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize) |
| 868 | { |