[Webkit-unassigned] [Bug 108881] Canvas fillText and measureText handle ideographic spaces differently

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 13 06:00:16 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=108881





--- Comment #33 from Rashmi Shyamasundar <rashmi.s2 at samsung.com>  2013-08-13 05:59:50 PST ---
Please comment on the below function "replaceHTMLSpace()", which can be used instead of the existing function "replaceCharacterInString()"

static void replaceHTMLSpace(String& text)
{    
    unsigned int textLength = text.length();
    std::vector<char> charVector(textLength);

    unsigned int i=0;
       while (i != textLength)
       {
               ch = text.characterStartingAt(i);
        if (!isHTMLSpace(ch))
            charVector[i] = ch;
        else    
            charVector[i] = ' ';
        i++;
        }
    charVector[i] = '\0';
    string tempText(charVector.begin(), charVector.end());
    String finalText(tempText.c_str(),textLength);
        text = finalText;
}


As suggested by Mr. Darin Adler, the above approach avoids the expensive memory re-allocations unlike the function replaceCharacterInString().

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list