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

Method setTextFontName

core/ui/UITextFieldEx.cpp:310–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void TextFieldEx::setTextFontName(std::string_view fontName)
311{
312 if (FileUtils::getInstance()->isFileExist(fontName))
313 {
314 TTFConfig config = _renderLabel->getTTFConfig();
315 config.fontFilePath = fontName;
316 config.fontSize = _fontSize;
317 _renderLabel->setTTFConfig(config);
318 _systemFontUsed = false;
319 _fontType = 1;
320 }
321 else
322 {
323 _renderLabel->setSystemFontName(fontName);
324 if (!_systemFontUsed)
325 {
326 _renderLabel->requestSystemFontRefresh();
327 }
328 _renderLabel->setSystemFontSize(_fontSize);
329 _systemFontUsed = true;
330 _fontType = 0;
331 }
332 _fontName = fontName;
333
334 using namespace std::string_view_literals;
335 _asteriskWidth = internalCalcStringWidth("*"sv, _fontName, _fontSize);
336}
337
338void TextFieldEx::setTextFontSize(float size)
339{

Callers

nothing calls this directly

Calls 6

getInstanceFunction · 0.85
internalCalcStringWidthFunction · 0.85
setTTFConfigMethod · 0.80
setSystemFontNameMethod · 0.80
setSystemFontSizeMethod · 0.80
isFileExistMethod · 0.45

Tested by

no test coverage detected