mirror of https://github.com/axmolengine/axmol.git
1. fixes TextReader load default font error.
This commit is contained in:
parent
e749a9a598
commit
a0ecae21c3
|
@ -102,8 +102,23 @@ namespace cocostudio
|
|||
label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
||||
|
||||
std::string fontName = DICTOOL->getStringValue_json(options, P_FontName, "微软雅黑");
|
||||
std::string file_extension = “”;
|
||||
size_t pos = fontName.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
file_extension = fontName.substr(pos, fontName.length());
|
||||
std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
|
||||
}
|
||||
if(file_extension.compare(".TTF") == 0)
|
||||
{
|
||||
std::string fontFilePath = jsonPath.append(fontName);
|
||||
label->setFontName(fontFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
label->setFontName(fontName);
|
||||
}
|
||||
|
||||
|
||||
bool aw = DICTOOL->checkObjectExist_json(options, P_AreaWidth);
|
||||
bool ah = DICTOOL->checkObjectExist_json(options, P_AreaHeight);
|
||||
|
|
Loading…
Reference in New Issue