Cocos2dx3.2正式版,ButtonReader存在BUG

ButtonReader是用于解析CocosStudio中Button属性的
但是解析Button的Title字体属性可能存在找不到字体的情况,应该是没有将字体属性拼接到jsonPath上造成的

std::string fontName = DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑");


 // Fix Bug: font path error
        std::string jsonPath = GUIReader::getInstance()->getFilePath();
        std::string fontFilePath = jsonPath.append(fontName);
 if (FileUtils::getInstance()->isFileExist(fontFilePath))
 {
 button->setTitleFontName(fontFilePath);
 }
 else{
 button->setTitleFontName(fontName);
 }


cococs2dx3.3rc0版本中发现该问题仍然存在,希望尽快修复,不要让更多人掉入此坑。。

可否提供下工程。

不用吧,比较TextReader中label->setFontName的写法就知道ButtonReader肯定是漏写了

哦。。这个。。。居然是我改的。
https://github.com/G17hao/cocos2d-x/commit/2f44e8fb205e9aee64d4603988c9e1123c05165e

有错吗?:10:

没错,但是源码中这段不知道去哪了:904:

  •    const char *fontName = DICTOOL->getStringValue_json(options, P_FontName);
    
  •    if (fontName != nullptr){
    
  •        std::string fontFilePath;
    
  •        std::string jsonPath = GUIReader::getInstance()->getFilePath();
    
  •        fontFilePath = jsonPath.append(fontName);
    
  •        if (FileUtils::getInstance()->isFileExist(fontFilePath)) {
    
  •            button->setTitleFontName(fontFilePath);
    
  •        }else{
    
  •            button->setTitleFontName(fontName);
    
  •        }
    
  •    }