From bd1a824a31bcfe8097643a49bf21fdc3501581f5 Mon Sep 17 00:00:00 2001
From: zmatsuo <6488847+zmatsuo@users.noreply.github.com>
Date: Thu, 31 Oct 2024 01:23:51 +0900
Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E7=94=BB=E6=99=82=E3=82=B5=E3=83=AD?=
=?UTF-8?q?=E3=82=B2=E3=83=BC=E3=83=88=E3=83=9A=E3=82=A2=E3=81=AE=E6=96=87?=
=?UTF-8?q?=E5=AD=97=E3=81=8C=E5=90=AB=E3=81=BE=E3=82=8C=E3=82=8B=E3=81=A8?=
=?UTF-8?q?=E3=81=8D=E6=8F=8F=E7=94=BB=E3=81=8C=E5=B4=A9=E3=82=8C=E3=82=8B?=
=?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=81=A3=E3=81=9F=E3=81=AE?=
=?UTF-8?q?=E3=81=A7=E4=BF=AE=E6=AD=A3=20#386?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 発生条件
- 描画幅に合わせてリサイズしたフォントを描画=on
- 描画文字にUTF-16(wchar_t)にしたときサロゲートペアの文字が含まれるとき
- サロゲートペア範囲 U+010000...U+10FFFF
---
doc/en/html/about/history.html | 1 +
doc/ja/html/about/history.html | 1 +
teraterm/teraterm/vtdisp.c | 10 ++++++++--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/doc/en/html/about/history.html b/doc/en/html/about/history.html
index 6490d8dac..24c63ead2 100644
--- a/doc/en/html/about/history.html
+++ b/doc/en/html/about/history.html
@@ -63,6 +63,7 @@
YYYY.MM.DD (Ver 5.4 not released yet)
Unnecessary overwrite confirmation dialog is no longer displayed when selecting a existing file as a log file at file selecting dialog box.
MACRO: Fixed TTL cannot be execute when it is UTF-8 without BOM.
Fixed to handle U+20000 to U+3FFFF of UTF-8.
+ Fixed display characters containing surrogate pair character when "Drawing resized font to fit cell width"
diff --git a/doc/ja/html/about/history.html b/doc/ja/html/about/history.html
index 80ac38d6a..c1bbe14f7 100644
--- a/doc/ja/html/about/history.html
+++ b/doc/ja/html/about/history.html
@@ -63,6 +63,7 @@ YYYY.MM.DD (Ver 5.4 not released yet)
Ot@CƂăt@CI_CAOŊ̃t@Cw肵ɏ㏑mF_CAO\Ȃ悤ɂB
MACRO: TTL t@C BOM Ȃ UTF-8 ̏ꍇAsłȂCB
UTF-8 U+20000 U+3FFFF 𐳂悤CB
+ "Drawing resized font to fit cell width" on ̂ƂATQ[gyA݂̕Ƃ\悤CB
diff --git a/teraterm/teraterm/vtdisp.c b/teraterm/teraterm/vtdisp.c
index 92e0acef6..47b5f5441 100644
--- a/teraterm/teraterm/vtdisp.c
+++ b/teraterm/teraterm/vtdisp.c
@@ -2887,6 +2887,12 @@ static void DrawStrWSub(HDC DC, HDC BGDC, const wchar_t *StrW, const int *Dx,
* StrW U+307B U+309A
* cells 0 2
*
+ * len=4
+ * g(悵)
+ * 0 1 2
+ * StrW 0xd842 0xdfb7 0x91ce 0x5bb6
+ * cells 0 2 2 2
+ *
*/
void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *cells, int len, int font_width, int font_height,
int Y, int *X)
@@ -2926,7 +2932,7 @@ void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *cells, int len,
else {
SIZE size;
GetTextExtentPoint32W(DC, &StrW[i - zero_count], 1 + zero_count, &size);
- if ((size.cx == Dx[i]) || (size.cx == Dx[i] + 1)) {
+ if (zero_count == 0 && ((size.cx == Dx[i]) || (size.cx == Dx[i] + 1))) {
wchar_count++;
cell_count += cells[i];
}
@@ -2938,10 +2944,10 @@ void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *cells, int len,
}
DrawChar(DC, BGDC, *X, Y, &StrW[i - zero_count], 1 + zero_count, cells[i]);
*X += cells[i] * FontWidth;
+ start_idx += 1 + zero_count;
zero_count = 0;
cell_count = 0;
wchar_count = 0;
- start_idx++;
}
}
}