aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2019-04-12 08:22:21 +1000
committerZufu Liu <unknown>2019-04-12 08:22:21 +1000
commitc597d73ba23375ab2b86489e0818aad7a86e402b (patch)
treeb449d1748833875c79350d1501cae28841af7fc8
parenta20a9100b9b76caa23bd3889e13bde87e86cdbb7 (diff)
downloadscintilla-mirror-c597d73ba23375ab2b86489e0818aad7a86e402b.tar.gz
Bug [#2093]. Improve efficiency with single byte character sets.
-rw-r--r--src/DBCS.h8
-rw-r--r--win32/PlatWin.cxx4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/DBCS.h b/src/DBCS.h
index ff3f9f22f..58659ee3e 100644
--- a/src/DBCS.h
+++ b/src/DBCS.h
@@ -10,6 +10,14 @@
namespace Scintilla {
+constexpr bool IsDBCSCodePage(int codePage) noexcept {
+ return codePage == 932
+ || codePage == 936
+ || codePage == 949
+ || codePage == 950
+ || codePage == 1361;
+}
+
bool DBCSIsLeadByte(int codePage, char ch) noexcept;
}
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index d1ff19b55..709c876b4 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1194,7 +1194,7 @@ void SurfaceD2D::SetFont(Font &font_) {
yDescent = pfm->yDescent;
yInternalLeading = pfm->yInternalLeading;
codePageText = codePage;
- if (pfm->characterSet) {
+ if (!unicodeMode && pfm->characterSet) {
codePageText = Scintilla::CodePageFromCharSet(pfm->characterSet, codePage);
}
if (pRenderTarget) {
@@ -2021,7 +2021,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, std::string_view text, XYPOSITION *p
while (i<text.length()) {
positions[i++] = lastPos;
}
- } else if (codePageText == 0) {
+ } else if (!IsDBCSCodePage(codePageText)) {
// One char per position
PLATFORM_ASSERT(text.length() == static_cast<size_t>(tbuf.tlen));