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

Method setFontName

core/ui/UIText.cpp:154–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void Text::setFontName(std::string_view name)
155{
156 if (FileUtils::getInstance()->isFileExist(name))
157 {
158 TTFConfig config = _labelRenderer->getTTFConfig();
159 config.fontFilePath = name;
160 config.fontSize = _fontSize;
161 _labelRenderer->setTTFConfig(config);
162 _type = Type::TTF;
163 }
164 else
165 {
166 _labelRenderer->setSystemFontName(name);
167 if (_type == Type::TTF)
168 {
169 _labelRenderer->requestSystemFontRefresh();
170 }
171 _type = Type::SYSTEM;
172 }
173 _fontName = name;
174 updateContentSizeWithTextureSize(_labelRenderer->getContentSize());
175 _labelRendererAdaptDirty = true;
176}
177
178std::string_view Text::getFontName() const
179{

Callers 15

initMethod · 0.95
initMethod · 0.45
initMethod · 0.45
MenuLayerMainMenuMethod · 0.45
setPropsFromBinaryMethod · 0.45
setPropsFromBinaryMethod · 0.45

Calls 5

getInstanceFunction · 0.85
setTTFConfigMethod · 0.80
setSystemFontNameMethod · 0.80
isFileExistMethod · 0.45
getContentSizeMethod · 0.45

Tested by 3

initMethod · 0.36
initMethod · 0.36
MenuLayerMainMenuMethod · 0.36