D11552: [WIP] Handle CJK characters

Christoph Feck noreply at phabricator.kde.org
Thu Mar 22 20:58:46 UTC 2018


cfeck added inline comments.

INLINE COMMENTS

> characterrangescjk.cpp:35
> +    for (int i = 0; i < text.length(); i++) {
> +        const QChar& c = text.at(i);
> +        if (m_graphemeWords.contains(c.script()) && c.isLetter()) {

Add surrogate pair handling. Basic outline:

  uint c = text.at(i);
  if (QChar::isSurrogate(c)) {
      c = QChar::surrogateToUcs4(c, text.at(++i));
  }
  if (QChar::isLetter(c) ...

You would need to add 'i' bounds checking, and verifying that you are indeed seeing a valid pair.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D11552

To: michaelh, hein
Cc: bruns, lbeltrame, #frameworks, alexeymin, cfeck, ashaposhnikov, michaelh, astippich, spoorun, nicolasfella, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180322/9a3703e5/attachment.html>


More information about the Kde-frameworks-devel mailing list