Revision: 10042 https://osdn.net/projects/ttssh2/scm/svn/commits/10042 Author: zmatsuo Date: 2022-07-06 23:11:33 +0900 (Wed, 06 Jul 2022) Log Message: ----------- Unicode文字幅の初期値をOSの言語から決定するようにした - 次の文字幅の初期値(TERATERM.INIに未設定時) - Ambiguous Characters width - Unicode Emoji width - 従来は1固定だった - japanese(日本語)、Korean、Chinaの場合は 2 とするようにした - Tera Term 4 からiniファイルを移行した場合でも違和感なく使えるよう考慮 ticket #45006 Ticket Links: ------------ https://osdn.net/projects/ttssh2/tracker/detail/45006 Modified Paths: -------------- trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2022-07-05 15:18:35 UTC (rev 10041) +++ trunk/teraterm/ttpset/ttset.c 2022-07-06 14:11:33 UTC (rev 10042) @@ -764,6 +764,23 @@ ts->EtermLookfeel.BGNoFrame); } +/** + * Unicode Ambiguous,Emoji \x82̃f\x83t\x83H\x83\x8B\x83g\x95\x9D + */ +static int GetDefaultUnicodeWidth(void) +{ + int ret_val = 1; + const int langcode = GetUserDefaultUILanguage(); + if (langcode == 0x0411 || // Japanese + langcode == 0x0412 || // Korean + langcode == 0x0404 || // Chinese (Traditional) + langcode == 0x0804 ) // Chinese (Simplified) + { + ret_val = 2; + } + return ret_val; +} + void PASCAL ReadIniFile(const wchar_t *FName, PTTSet ts) { int i; @@ -2252,14 +2269,14 @@ &ts->DialogFontPoint, &ts->DialogFontCharSet); // Unicode\x90ݒ\xE8 - ts->UnicodeAmbiguousWidth = GetPrivateProfileInt(Section, "UnicodeAmbiguousWidth", 1, FName); + ts->UnicodeAmbiguousWidth = GetPrivateProfileInt(Section, "UnicodeAmbiguousWidth", 0, FName); if (ts->UnicodeAmbiguousWidth < 1 || 2 < ts->UnicodeAmbiguousWidth) { - ts->UnicodeAmbiguousWidth = 1; + ts->UnicodeAmbiguousWidth = GetDefaultUnicodeWidth(); } ts->UnicodeEmojiOverride = (BYTE)GetOnOff(Section, "UnicodeEmojiOverride", FName, FALSE); - ts->UnicodeEmojiWidth = GetPrivateProfileInt(Section, "UnicodeEmojiWidth", 1, FName); + ts->UnicodeEmojiWidth = GetPrivateProfileInt(Section, "UnicodeEmojiWidth", 0, FName); if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { - ts->UnicodeEmojiWidth = 1; + ts->UnicodeEmojiWidth = GetDefaultUnicodeWidth(); } DispReadIni(FName, ts);