Revision: 10345 https://osdn.net/projects/ttssh2/scm/svn/commits/10345 Author: zmatsuo Date: 2022-11-02 22:43:19 +0900 (Wed, 02 Nov 2022) Log Message: ----------- TERATERM.INI の UnknownUnicodeCharacterAsWide を削除 - 不明な文字幅がなくなったため不要となった - tttypes.UnknownUnicodeCharaAsWide を削除 - 関連ドキュメントを修正 - 表示できない文字の場合は '?' が文字のセル幅表示 - ANSI API(Additional setting - Font)で描画時 - エスケープシーケンスによる印字はANSIで行う - "\x1b[5i" から - "\x1b[4i" まで Modified Paths: -------------- trunk/doc/en/html/setup/teraterm-ini.html trunk/doc/en/html/setup/teraterm-term.html trunk/doc/en/html/setup/teraterm.html trunk/doc/ja/html/setup/teraterm-ini.html trunk/doc/ja/html/setup/teraterm-term.html trunk/doc/ja/html/setup/teraterm.html trunk/installer/release/TERATERM.INI trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/buffer.c trunk/teraterm/teraterm/teraprn.cpp trunk/teraterm/teraterm/teraprn.h trunk/teraterm/teraterm/vtdisp.c trunk/teraterm/teraterm/vtdisp.h trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/doc/en/html/setup/teraterm-ini.html =================================================================== --- trunk/doc/en/html/setup/teraterm-ini.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/en/html/setup/teraterm-ini.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -1298,12 +1298,6 @@ <td></td> </tr> <tr> - <td id="UnknownUnicodeCharacterAsWide"><a href="teraterm-term.html#UnknownUnicodeCharacterAsWide">UnknownUnicodeCharacterAsWide</a></td> - <td style="width:250px;">off</td> - <td style="width:250px;"><-</td> - <td></td> - </tr> - <tr> <td id="UnderlineAttrColor"><a href="../menu/setup-additional-visual.html#EnableUnderlineAttrColor">UnderlineAttrColor</a></td> <td style="width:250px;">on</td> <td style="width:250px;"><-</td> Modified: trunk/doc/en/html/setup/teraterm-term.html =================================================================== --- trunk/doc/en/html/setup/teraterm-term.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/en/html/setup/teraterm-term.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -228,21 +228,6 @@ </pre> -<h1 id="UnknownUnicodeCharacterAsWide">Display unsupported Unicode character as wide character</h1> - -<p> -When the received KANJI code is UTF-8 or UTF-8m, a user can configure the behavior of the Unicode characters which Tera Term does not support as the pure Unicode.<br> - -If this configuration value is on, the unsupported Unicode character is displayed as "??".<br> -If this configuration value is off, the unsupported Unicode character is displayed as "?". -</p> - -<pre> -Default: -UnknownUnicodeCharacterAsWide=off -</pre> - - <h1 id="UnicodeDecSpMapping">Mapping of Unicode to DEC special character</h1> <p> Modified: trunk/doc/en/html/setup/teraterm.html =================================================================== --- trunk/doc/en/html/setup/teraterm.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/en/html/setup/teraterm.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -73,7 +73,6 @@ <li><a href="teraterm-term.html#tekgin">Mouse code in TEK GIN report</a></li> <li><a href="teraterm-term.html#vttab">Displaying tab at end of line like VT terminal</a></li> <li><a href="teraterm-term.html#ScrollWindowClearScreen">Scroll down the current buffer when the screen is clear</a></li> - <li><a href="teraterm-term.html#UnknownUnicodeCharacterAsWide">Display unsupported Unicode character as wide character</a></li> <li><a href="teraterm-term.html#UnicodeDecSpMapping">Mapping of Unicode to DEC special character</a></li> <li><a href="teraterm-term.html#StrictKeyMapping">Mapping of the function key</a></li> <li><a href="teraterm-term.html#Meta8Bit">Sending MSB set character with Alt key</a></li> Modified: trunk/doc/ja/html/setup/teraterm-ini.html =================================================================== --- trunk/doc/ja/html/setup/teraterm-ini.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/ja/html/setup/teraterm-ini.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -1304,12 +1304,6 @@ <td></td> </tr> <tr> - <td id="UnknownUnicodeCharacterAsWide"><a href="teraterm-term.html#UnknownUnicodeCharacterAsWide">UnknownUnicodeCharacterAsWide</a></td> - <td style="width:250px;">off</td> - <td style="width:250px;"><-</td> - <td></td> - </tr> - <tr> <td id="UnderlineAttrColor"><a href="../menu/setup-additional-visual.html#EnableUnderlineAttrColor">UnderlineAttrColor</a></td> <td style="width:250px;">on</td> <td style="width:250px;"><-</td> Modified: trunk/doc/ja/html/setup/teraterm-term.html =================================================================== --- trunk/doc/ja/html/setup/teraterm-term.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/ja/html/setup/teraterm-term.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -296,20 +296,6 @@ </pre> -<h1 id="UnknownUnicodeCharacterAsWide">\x91Ή\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2Unicode\x82̕\xB6\x8E\x9A\x82\xF0\x83\x8F\x83C\x83h\x95\xB6\x8E\x9A\x82Ƃ\xB5\x82Ĉ\xB5\x82\xA4\x82\xA9\x90ݒ肷\x82\xE9</h1> - -<p> -\x8E\xF3\x90M\x8A\xBF\x8E\x9A\x83R\x81[\x83h\x82\xAAUTF-8\x82܂\xBD\x82\xCDUTF-8m\x82̐ݒ\xE8\x82̎\x9E\x82ɁATera Term\x82\xAA\x91Ή\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2Unicode\x82̕\xB6\x8E\x9A\x82̎\xE6\x82舵\x82\xA2\x82\xF0\x90ݒ肵\x82܂\xB7\x81B<br> -on \x82̏ꍇ\x82ɂ́A\x91Ή\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2Unicode\x82̕\xB6\x8E\x9A\x82\xF0 "??" \x82ƕ\\x8E\xA6\x82\xB5\x82܂\xB7\x81B<br> -off \x82̏ꍇ\x82ɂ́A\x91Ή\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2Unicode\x82̕\xB6\x8E\x9A\x82\xF0 "?" \x82ƕ\\x8E\xA6\x82\xB5\x82܂\xB7\x81B -</p> - -<pre> -\x8Fȗ\xAA\x8E\x9E: -UnknownUnicodeCharacterAsWide=off -</pre> - - <h1 id="UnicodeDecSpMapping">Unicode\x82\xA9\x82\xE7DEC\x93\xC1\x8Eꕶ\x8E\x9A\x82ւ̃}\x83b\x83s\x83\x93\x83O\x82\xF0\x90ݒ肷\x82\xE9</h1> <p> Modified: trunk/doc/ja/html/setup/teraterm.html =================================================================== --- trunk/doc/ja/html/setup/teraterm.html 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/doc/ja/html/setup/teraterm.html 2022-11-02 13:43:19 UTC (rev 10345) @@ -43,7 +43,6 @@ <li><a href="teraterm-term.html#tekgin">TEK GIN report \x82̃}\x83E\x83X\x83R\x81[\x83h\x82̒l\x82\xF0\x90ݒ肷\x82\xE9</a></li> <li><a href="teraterm-term.html#vttab">\x8Ds\x96\x96\x82̃^\x83u\x95\\x8E\xA6\x82\xF0 VT \x92[\x96\x96\x8C݊\xB7\x82ɂ\xB7\x82\xE9</a></li> <li><a href="teraterm-term.html#ScrollWindowClearScreen">\x89\xE6\x96ʃN\x83\x8A\x83A\x8E\x9E\x82ɃJ\x83\x8C\x83\x93\x83g\x83o\x83b\x83t\x83@\x82\xF0\x83X\x83N\x83\x8D\x81[\x83\x8B\x83A\x83E\x83g\x82\xB3\x82\xB9\x82邩\x82ǂ\xA4\x82\xA9\x90ݒ肷\x82\xE9</a></li> - <li><a href="teraterm-term.html#UnknownUnicodeCharacterAsWide">\x91Ή\x9E\x82\xB5\x82Ă\xA2\x82Ȃ\xA2Unicode\x82̕\xB6\x8E\x9A\x82\xF0\x83\x8F\x83C\x83h\x95\xB6\x8E\x9A\x82Ƃ\xB5\x82Ĉ\xB5\x82\xA4\x82\xA9\x90ݒ肷\x82\xE9</a></li> <li><a href="teraterm-term.html#UnicodeDecSpMapping">Unicode\x82\xA9\x82\xE7DEC\x93\xC1\x8Eꕶ\x8E\x9A\x82ւ̃}\x83b\x83s\x83\x93\x83O\x82\xF0\x90ݒ肷\x82\xE9</a></li> <li><a href="teraterm-term.html#StrictKeyMapping">\x83t\x83@\x83\x93\x83N\x83V\x83\x87\x83\x93\x83L\x81[\x93\x99\x82̃f\x83t\x83H\x83\x8B\x83g\x82̓\xAE\x8D\xEC</a></li> <li><a href="teraterm-term.html#Meta8Bit">Alt\x83L\x81[\x82\xC5MSB\x82\xF0\x83Z\x83b\x83g\x82\xB5\x82\xBD\x95\xB6\x8E\x9A\x82𑗐M\x82\xB7\x82\xE9</a></li> Modified: trunk/installer/release/TERATERM.INI =================================================================== --- trunk/installer/release/TERATERM.INI 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/installer/release/TERATERM.INI 2022-11-02 13:43:19 UTC (rev 10345) @@ -683,9 +683,6 @@ ; Trim trailing new line character when pasting TrimTrailingNLonPaste=off -; Unknown Unicode character handling -UnknownUnicodeCharacterAsWide=off - ; Mapping of Unicode to DEC special character ; The sum of following values: ; 1 : Box drawings (U+2500-U+257F) Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/common/tttypes.h 2022-11-02 13:43:19 UTC (rev 10345) @@ -516,7 +516,7 @@ WORD TEKIcon; WORD ScrollWindowClearScreen; WORD AutoScrollOnlyInBottomLine; - WORD UnknownUnicodeCharaAsWide; + WORD reserve_UnknownUnicodeCharaAsWide; char YModemRcvCommand[MAX_PATH]; WORD AcceptTitleChangeRequest; SIZE PasteDialogSize; Modified: trunk/teraterm/teraterm/buffer.c =================================================================== --- trunk/teraterm/teraterm/buffer.c 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/teraterm/buffer.c 2022-11-02 13:43:19 UTC (rev 10345) @@ -179,21 +179,7 @@ switch (lenA) { case 0: default: -#if 1 - if (half_width) { - p->ansi_char = '?'; - } - else { - p->ansi_char = (('?' << 8) | '_'); - } -#else - if (ts.UnknownUnicodeCharaAsWide) { - p->ansi_char = (('?' << 8) | '?'); - } - else { - p->ansi_char = '?'; - } -#endif + p->ansi_char = '?'; break; case 1: p->ansi_char = (unsigned char)strA[0]; @@ -3178,7 +3164,7 @@ static void BuffGetDrawInfoW(int SY, int IStart, int IEnd, void (*disp_strW)(const wchar_t *bufW, const char *width_info, int count, void *data), - void (*disp_strA)(const char *buf, int count, void *data), + void (*disp_strA)(const char *buf, const char *width_info, int count, void *data), void (*disp_setup_dc)(TCharAttr Attr, BOOL Reverse), void *data) { @@ -3185,6 +3171,7 @@ const LONG TmpPtr = GetLinePtr(SY); int istart = IStart; char bufA[TermWidthMax+1]; + char bufAW[TermWidthMax+1]; wchar_t bufW[TermWidthMax+1]; char bufWW[TermWidthMax+1]; int lenW = 0; @@ -3205,7 +3192,6 @@ BOOL DrawFlag = FALSE; BOOL SetString = FALSE; - unsigned short ansi_char; // \x83A\x83g\x83\x8A\x83r\x83\x85\x81[\x83g\x8E擾 if (count == 0) { @@ -3274,17 +3260,36 @@ DrawFlag = TRUE; // \x83R\x83\x93\x83r\x83l\x81[\x83V\x83\x87\x83\x93\x82\xAA\x82\xA0\x82\xE9\x8Fꍇ\x82͂\xB7\x82\xAE\x95`\x89\xE6 } - ansi_char = CodeBuffW[TmpPtr + istart + count].ansi_char; - if (ansi_char < 0x100) { - bufA[lenA] = ansi_char & 0xff; - lenA++; + // ANSI\x94\xC5 + { + unsigned short ansi_char = b->ansi_char; + int i; + int cell = b->cell; + int c = 0; + if (ansi_char < 0x100) { + bufA[lenA] = ansi_char & 0xff; + bufAW[lenA] = cell; + lenA++; + c++; + } + else { + bufA[lenA] = (ansi_char >> 8) & 0xff; + bufAW[lenA] = cell; + lenA++; + c++; + bufA[lenA] = ansi_char & 0xff; + bufAW[lenA] = 0; + lenA++; + c++; + } + // ANSI\x95\xB6\x8E\x9A\x97\xF1\x82ŕ\\x8E\xA6\x82ł\xAB\x82\xE9\x82̂\xCD 1or2cell(\x94\xBC\x8Apor\x91S\x8Ap) + // \x8Ec\x82\xE8\x82\xCD '?' \x82\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9 + for (i = c; i < cell; i++) { + bufA[lenA] = '?'; + bufAW[lenA] = 0; + lenA++; + } } - else { - bufA[lenA] = (ansi_char >> 8) & 0xff; - lenA++; - bufA[lenA] = ansi_char & 0xff; - lenA++; - } if (b->WidthProperty == 'A' || b->WidthProperty == 'N') { DrawFlag = TRUE; @@ -3313,7 +3318,7 @@ disp_strW(bufW, bufWW, lenW, data); } else { - disp_strA(bufA, lenA, data); + disp_strA(bufA, bufAW, lenA, data); } lenA = 0; @@ -3341,12 +3346,12 @@ data->draw_x = x; } -static void l_disp_strA(const char *buf, int count, void *data_) +static void l_disp_strA(const char *buf, const char *width_info, int count, void *data_) { disp_data_t *data = (disp_data_t *)data_; int x = data->draw_x; int y = data->draw_y; - DispStr(buf, count, y, &x); + DispStrA(buf, width_info, count, y, &x); data->draw_x = x; } @@ -3407,7 +3412,7 @@ IEnd = NumOfColumns - 1; } - BuffGetDrawInfoW(SY, IStart, IEnd, PrnOutTextW, PrnOutText, PrnSetupDC, NULL); + BuffGetDrawInfoW(SY, IStart, IEnd, PrnOutTextW, PrnOutTextA, PrnSetupDC, NULL); } void BuffUpdateRect Modified: trunk/teraterm/teraterm/teraprn.cpp =================================================================== --- trunk/teraterm/teraterm/teraprn.cpp 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/teraterm/teraprn.cpp 2022-11-02 13:43:19 UTC (rev 10345) @@ -366,7 +366,7 @@ * Buff: points text buffer * Count: number of characters to be printed */ -void PrnOutText(const char *StrA, int Count, void *data) +void PrnOutTextA(const char *StrA, const char *WidthInfo, int Count, void *data) { if (PrnX+PrnFW > Margin.right) { /* new line */ @@ -381,7 +381,7 @@ PrnY = Margin.top; } - DrawStrA(PrintDC, NULL, StrA, Count, PrnFW, PrnFH, PrnY, &PrnX); + DrawStrA(PrintDC, NULL, StrA, WidthInfo, Count, PrnFW, PrnFH, PrnY, &PrnX); } void PrnOutTextW(const wchar_t *StrW, const char *WidthInfo, int Count, void *data) @@ -485,6 +485,33 @@ free(handle); } +static void PrnOutText(const char *StrA, int Count, void *data) +{ + // \x95\xB6\x8E\x9A\x95\x9D\x8F\xEE\x95\xF1\x82\xF0\x8D\xEC\x82\xE9 + // MBCS\x82̂Ƃ\xAB\x81A1byte=1cell, 2byte=2cell + char *WidthInfo = (char *)malloc(Count); + char *w = WidthInfo; + BYTE *s = (BYTE*)StrA; + for (int i = 0; i < Count; i++) { + BYTE b = *s++; + if (__ismbblead(b, CP_ACP)) { + // 2byte\x95\xB6\x8E\x9A + *w++ = 2; + *w++ = 0; + s++; + i++; + } + else { + // 1byte\x95\xB6\x8E\x9A + *w++ = 1; + } + } + + DrawStrA(PrintDC, NULL, StrA, WidthInfo, Count, PrnFW, PrnFH, PrnY, &PrnX); + + free(WidthInfo); +} + /** * \x88p\x82ɕۑ\xB6\x82\xB5\x82Ă\xA2\x82\xBD\x83t\x83@\x83C\x83\x8B\x82\xA9\x82\xE7\x88\xB7\x82\xE9 */ Modified: trunk/teraterm/teraterm/teraprn.h =================================================================== --- trunk/teraterm/teraterm/teraprn.h 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/teraterm/teraprn.h 2022-11-02 13:43:19 UTC (rev 10345) @@ -48,7 +48,7 @@ int VTPrintInit(int PrnFlag); void PrnSetupDC(TCharAttr Attr, BOOL reverse); -void PrnOutText(const char *Buff, int Count, void *data); +void PrnOutTextA(const char *Buff, const char *WidthInfo, int Count, void *data); void PrnOutTextW(const wchar_t *StrW, const char *WidthInfo, int Count, void *data); void PrnNewLine(); void VTPrintEnd(); Modified: trunk/teraterm/teraterm/vtdisp.c =================================================================== --- trunk/teraterm/teraterm/vtdisp.c 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/teraterm/vtdisp.c 2022-11-02 13:43:19 UTC (rev 10345) @@ -2569,9 +2569,10 @@ /** * 1\x8Ds\x95`\x89\xE6 ANSI */ -void DrawStrA(HDC DC, HDC BGDC, const char *StrA, int Count, int font_width, int font_height, int Y, int *X) +void DrawStrA(HDC DC, HDC BGDC, const char *StrA, const char *WidthInfo, int Count, int font_width, int font_height, int Y, int *X) { int Dx[TermWidthMax]; + int HalfCharCount = 0; int i; int width; int height; @@ -2579,8 +2580,24 @@ BYTE alpha = 0; vtdisp_work_t *w = &vtdisp_work; - for (i = 0; i < Count; i++) { - Dx[i] = font_width; + { + const BYTE *p = (BYTE *)StrA; + const char *wp = WidthInfo; + int *d = Dx; + for (i = 0; i < Count; i++) { + int w = *wp++; + BYTE b = *p; + int j; + *d++ = font_width; + p++; + for (j = 0; j < w - 1; j++) { + *d++ = font_width; + p++; + wp++; + i++; + } + HalfCharCount += w; + } } direct_draw = FALSE; @@ -2596,7 +2613,7 @@ } // \x83e\x83L\x83X\x83g\x95`\x89\xE6\x97̈\xE6 - width = Count * font_width; + width = HalfCharCount * font_width; height = font_height; if (direct_draw) { RECT RText; @@ -2738,10 +2755,10 @@ * @param[in] *X horizontal position * @param[out] *X horizontal position shifted by the width of the string */ -void DispStr(const char *Buff, int Count, int Y, int* X) +void DispStrA(const char *Buff, const char *WidthInfo, int Count, int Y, int* X) { HDC BGDC = BGEnable ? hdcBGBuffer : NULL; - DrawStrA(VTDC, BGDC, Buff, Count, FontWidth, FontHeight, Y, X); + DrawStrA(VTDC, BGDC, Buff, WidthInfo, Count, FontWidth, FontHeight, Y, X); } /** Modified: trunk/teraterm/teraterm/vtdisp.h =================================================================== --- trunk/teraterm/teraterm/vtdisp.h 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/teraterm/vtdisp.h 2022-11-02 13:43:19 UTC (rev 10345) @@ -98,7 +98,7 @@ void DispInitDC(void); void DispReleaseDC(void); void DispSetupDC(TCharAttr Attr, BOOL Reverse); -void DispStr(const char *Buff, int Count, int Y, int* X); +void DispStrA(const char *Buff, const char *WidthInfo, int Count, int Y, int* X); void DispStrW(const wchar_t *StrW, const char *WidthInfo, int Count, int Y, int* X); void DispEraseCurToEnd(int YEnd, const TCharAttr *attr); void DispEraseHomeToCur(int YHome, const TCharAttr *attr); @@ -132,10 +132,10 @@ void DispGetWindowSize(int *width, int *height, BOOL client); void DispGetRootWinSize(int *x, int *y, BOOL inPixels); int DispFindClosestColor(int red, int green, int blue); -void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *WidthInfo, int Count, - int font_width, int font_height, int Y, int* X); -void DrawStrA(HDC DC, HDC BGDC, const char *StrA, int Count, - int font_width, int font_height, int Y, int* X); +void DrawStrW(HDC DC, HDC BGDC, const wchar_t *StrW, const char *WidthInfo, int Count, int font_width, int font_height, + int Y, int *X); +void DrawStrA(HDC DC, HDC BGDC, const char *StrA, const char *WidthInfo, int Count, int font_width, int font_height, + int Y, int *X); extern int WinWidth, WinHeight; extern HFONT VTFont[AttrFontMask+1]; Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2022-11-02 13:43:04 UTC (rev 10344) +++ trunk/teraterm/ttpset/ttset.c 2022-11-02 13:43:19 UTC (rev 10345) @@ -1607,10 +1607,6 @@ Temp, sizeof(Temp), FName); ts->TEKIcon = IconName2IconIdA(Temp); - // Unknown Unicode Character - ts->UnknownUnicodeCharaAsWide = - GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE); - // UseNormalBGColor ts->UseNormalBGColor = GetOnOff(Section, "UseNormalBGColor", FName, FALSE); @@ -2901,10 +2897,6 @@ WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName, ts->AutoScrollOnlyInBottomLine); - // Unknown Unicode Character - WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, - ts->UnknownUnicodeCharaAsWide); - // Accept remote-controlled window title changing if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff) strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);