Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIRichText does not handle well "\n" #14188

Open
pekayatt opened this issue Oct 19, 2015 · 2 comments
Open

UIRichText does not handle well "\n" #14188

pekayatt opened this issue Oct 19, 2015 · 2 comments

Comments

@pekayatt
Copy link

Most of it from:
http://discuss.cocos2d-x.org/t/does-richtext-support-multiple-line-of-text/21105/9

It only handles a element "\n", when it is in the middle of the text all element goes crazy.

@pekayatt
Copy link
Author

On JS this code has show some efficiency:

at line 400 on UIRichText.js

if(text.indexOf("\n") > -1) { //String contains \n
var leftLength = text.indexOf("\n")+2;
var leftWords = text.substr(0, leftLength -2);
var cutWords = text.substr(leftLength, text.length - 1);

        this._handleTextRenderer(leftWords.substr(0, leftLength), fontNameOrFontDef, fontSize, color);

        this._addNewLine();
        this._handleTextRenderer(cutWords, fontNameOrFontDef, fontSize, color);
        return;
    }

@minggo
Copy link
Contributor

minggo commented Jul 14, 2016

@pekayatt what's the error behavior? how can i reproduce it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants