From ff707f0fe276677a4d89633ae4964e8b94712ca3 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Thu, 22 Mar 2018 15:02:38 +1100 Subject: Feature [feature-requests:#1211]. Use pre-computed table for UTF8BytesOfLead. Friendlier treatment of invalid UTF-8. Add tests for UniConversion handling invalid UTF-8. Simplify UTF8Classify tests. --- qt/ScintillaEditBase/PlatQt.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'qt/ScintillaEditBase/PlatQt.cpp') diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 713f4c46f..87496a191 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -10,6 +10,7 @@ #include "PlatQt.h" #include "Scintilla.h" +#include "UniConversion.h" #include "DBCS.h" #include "FontQuality.h" @@ -438,19 +439,6 @@ void SurfaceImpl::SetClip(PRectangle rc) GetPainter()->setClipRect(QRectFFromPRect(rc)); } -static size_t utf8LengthFromLead(unsigned char uch) -{ - if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) { - return 4; - } else if (uch >= (0x80 + 0x40 + 0x20)) { - return 3; - } else if (uch >= (0x80)) { - return 2; - } else { - return 1; - } -} - void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, @@ -470,10 +458,10 @@ void SurfaceImpl::MeasureWidths(Font &font, const unsigned char *us = reinterpret_cast(s); int i=0; while (ui