From 93462d87c3c8f398d5900be84349f29cb088d849 Mon Sep 17 00:00:00 2001 From: mitchell Date: Sat, 5 May 2018 11:52:27 -0400 Subject: Backport: 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. Backport of changeset 6643:ebbb4e5aaf93. --- cocoa/PlatCocoa.mm | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'cocoa') diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index ea4149d97..ab9d449a0 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -31,6 +31,7 @@ #include "StringCopy.h" #include "XPM.h" +#include "UniConversion.h" #import "ScintillaView.h" #import "ScintillaCocoa.h" @@ -923,18 +924,6 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION yba textLayout->draw(rc.left, ybase); } -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, XYPOSITION *positions) @@ -952,10 +941,10 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION const unsigned char *us = reinterpret_cast(s); int i=0; while (ui(xPosition); } ui += codeUnits; -- cgit v1.2.3