cocos2d-x3.0.1, loading Cocostudio UI editor exported json file appears "Buffer is too small" && 0 solution

Source: Internet
Author: User

Just came to this company, began to carry out the real project development of Cocos2d-x, in order to be able to better expand later, change little, decided to use 3. x version development, and use the UI editor. In the import, today encountered a problem, Buffer is too small, searched a lot, but there is no solution to the solution, and finally found a wrong inducement, because the UI used the label, so I tried to find it is really a label caused by the problem, Each run exception occurs in the CCDevice.cpp

strcpy_s (Tnewfont.lffacename, Lf_facesize, Fontname.c_str ()) in bool SetFont (const char * pfontname = NULL, int nSize = 0); Because Fontname.c_str () is too long to cross the border, Tnewfont.lffacename length is only 32 bytes, and then see why FontName is too long, while others are normal, found in TextRead.cpp file

void Textreader::setpropsfromjsondictionary (Widget *widget, const rapidjson::value &options).

std::string fontname = Dictool->getstringvalue_json (options, P_fontname, "Microsoft Jas Black");
std::string Fontfilepath = Jsonpath.append (FontName);
Label->setfontname (Fontfilepath);

These lines of code will fontfilepath the path to the increase, in fact, only by passing fontname on the line, so, instead of

std::string fontname = Dictool->getstringvalue_json (options, P_fontname, "Microsoft Jas Black");
std::string Fontfilepath = Jsonpath.append (FontName);
Label->setfontname (FontName);

Normal after compilation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.