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

Method updateTTFConfigInternal

core/2d/Label.cpp:1321–1367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1319}
1320
1321bool Label::updateTTFConfigInternal(unsigned int mods)
1322{
1323 FontAtlas* newAtlas = FontAtlasCache::getFontAtlasTTF(&_fontConfig);
1324
1325 if (!newAtlas)
1326 {
1327 reset();
1328 return false;
1329 }
1330
1331 _currentLabelType = LabelType::TTF;
1332 bool atlasUpdated = setFontAtlas(newAtlas, _fontConfig.distanceFieldEnabled, true);
1333
1334 /*
1335 * In distance field text rendering, different font sizes share the same `fontAtlas`, so we need to additionally
1336 * check if `fontSize` has changed in order to set `contentDirty`. The same applies to `outlineSize`. See
1337 * `FontAtlasCache` for details.
1338 */
1339 if (!atlasUpdated && mods && _fontConfig.distanceFieldEnabled)
1340 _contentDirty = true;
1341
1342 if (_fontConfig.outlineSize > 0)
1343 {
1344 _useA8Shader = false;
1345 _currLabelEffect = LabelEffect::OUTLINE;
1346 updateShaderProgram();
1347 }
1348 else
1349 {
1350 if (_currLabelEffect != LabelEffect::GLOW)
1351 {
1352 _currLabelEffect = LabelEffect::NORMAL;
1353 updateShaderProgram();
1354 }
1355 }
1356
1357 if (_fontConfig.italics)
1358 this->enableItalics();
1359 if (_fontConfig.bold)
1360 this->enableBold();
1361 if (_fontConfig.underline)
1362 this->enableUnderline();
1363 if (_fontConfig.strikethrough)
1364 this->enableStrikethrough();
1365
1366 return true;
1367}
1368
1369void Label::setBMFontSizeInternal(float fontSize)
1370{

Callers

nothing calls this directly

Calls 5

enableItalicsMethod · 0.95
enableBoldMethod · 0.95
enableUnderlineMethod · 0.95
enableStrikethroughMethod · 0.95
resetFunction · 0.50

Tested by

no test coverage detected