[Ttssh2-commit] [7386] ダイアログフォント調整

scmno****@osdn***** scmno****@osdn*****
2019年 1月 10日 (木) 23:20:14 JST


Revision: 7386
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7386
Author:   zmatsuo
Date:     2019-01-10 23:20:14 +0900 (Thu, 10 Jan 2019)
Log Message:
-----------
ダイアログフォント調整

Modified Paths:
--------------
    branches/cmake/TTProxy/ProxyWSockHook.h
    branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c
    branches/cmake/teraterm/common/dlglib.c
    branches/cmake/teraterm/common/dlglib.h
    branches/cmake/teraterm/common/dlglib_tmpl.cpp
    branches/cmake/teraterm/common/i18n.c
    branches/cmake/teraterm/common/tt_res.h
    branches/cmake/teraterm/teraterm/teraterm.cpp
    branches/cmake/teraterm/teraterm/ttermpro.rc
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/vtwin.h
    branches/cmake/teraterm/ttpdlg/ttdlg.c
    branches/cmake/teraterm/ttpmacro/ttmacro.cpp
    branches/cmake/ttssh2/ttxssh/CMakeLists.txt
    branches/cmake/ttssh2/ttxssh/hosts.c
    branches/cmake/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: branches/cmake/TTProxy/ProxyWSockHook.h
===================================================================
--- branches/cmake/TTProxy/ProxyWSockHook.h	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/TTProxy/ProxyWSockHook.h	2019-01-10 14:20:14 UTC (rev 7386)
@@ -34,7 +34,7 @@
 
 void UTIL_set_dialog_font()
 {
-	SetDialogFont("TTProxy", UILanguageFile);
+	SetDialogFont(NULL, UILanguageFile, "TTProxy");
 }
 
 #if 0

Modified: branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c
===================================================================
--- branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -605,7 +605,7 @@
 static int PASCAL TTXProcessCommand(HWND hWin, WORD cmd) {
 	switch (cmd) {
 	  case ID_MENU_SETUP:
-		SetDialogFont("TTXRecurringCommand", pvar->ts->UILanguageFile);
+		SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTXRecurringCommand");
 		switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETUP_RECURRINGCOMMAND),
 		                       hWin, RecurringCommandSetting, (LPARAM)NULL)) {
 		  case IDOK:

Modified: branches/cmake/teraterm/common/dlglib.c
===================================================================
--- branches/cmake/teraterm/common/dlglib.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/common/dlglib.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -1,4 +1,4 @@
-/* -*- coding: utf-8-with-signature -*-	// TODO 文字コード
+/*
  * Copyright (C) 1994-1998 T. Teranishi
  * (C) 2008-2018 TeraTerm Project
  * All rights reserved.
@@ -125,8 +125,8 @@
 
 void SetDlgPercent(HWND HDlg, int id_Item, int id_Progress, LONG a, LONG b, int *p)
 {
-	// 20MB以上のファイルをアップロードしようとすると、buffer overflowで
-	// 落ちる問題への対処。(2005.3.18 yutaka)
+	// 20MB\x88ȏ\xE3\x82̃t\x83@\x83C\x83\x8B\x82\xF0\x83A\x83b\x83v\x83\x8D\x81[\x83h\x82\xB5\x82悤\x82Ƃ\xB7\x82\xE9\x82ƁAbuffer overflow\x82\xC5
+	// \x97\x8E\x82\xBF\x82\xE9\x96\xE2\x91\xE8\x82ւ̑Ώ\x88\x81B(2005.3.18 yutaka)
 	// cf. http://sourceforge.jp/tracker/index.php?func=detail&aid=5713&group_id=1412&atid=5333
 	double Num;
 	TCHAR NumStr[10];
@@ -228,11 +228,11 @@
 	BOOL ComboBox;
 } EditSubclassData;
 
-// C-n/C-p のためにサブクラス化 (2007.9.4 maya)
-// C-p/C-n/C-b/C-f/C-a/C-e をサポート (2007.9.5 maya)
-// C-d/C-k をサポート (2007.10.3 yutaka)
-// ドロップダウンの中のエディットコントロールを
-// サブクラス化するためのウインドウプロシージャ
+// C-n/C-p \x82̂\xBD\x82߂ɃT\x83u\x83N\x83\x89\x83X\x89\xBB (2007.9.4 maya)
+// C-p/C-n/C-b/C-f/C-a/C-e \x82\xF0\x83T\x83|\x81[\x83g (2007.9.5 maya)
+// C-d/C-k \x82\xF0\x83T\x83|\x81[\x83g (2007.10.3 yutaka)
+// \x83h\x83\x8D\x83b\x83v\x83_\x83E\x83\x93\x82̒\x86\x82̃G\x83f\x83B\x83b\x83g\x83R\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x82\xF0
+// \x83T\x83u\x83N\x83\x89\x83X\x89\xBB\x82\xB7\x82邽\x82߂̃E\x83C\x83\x93\x83h\x83E\x83v\x83\x8D\x83V\x81[\x83W\x83\x83
 static LRESULT CALLBACK HostnameEditProc(HWND dlg, UINT msg,
                                          WPARAM wParam, LPARAM lParam)
 {
@@ -244,7 +244,7 @@
 	char *str, *orgstr;
 
 	switch (msg) {
-		// キーが押されたのを検知する
+		// \x83L\x81[\x82\xAA\x89\x9F\x82\xB3\x82ꂽ\x82̂\xF0\x8C\x9F\x92m\x82\xB7\x82\xE9
 		case WM_KEYDOWN:
 			if (GetKeyState(VK_CONTROL) < 0) {
 				switch (wParam) {
@@ -296,17 +296,17 @@
 						if (str != NULL) {
 							len = GetWindowTextA(dlg, str, (int)max);
 							if (select >= 0 && select < len) {
-								if (wParam == 0x44) { // カーソル配下の文字のみを削除する
+								if (wParam == 0x44) { // \x83J\x81[\x83\\x83\x8B\x94z\x89\xBA\x82̕\xB6\x8E\x9A\x82݂̂\xF0\x8D폜\x82\xB7\x82\xE9
 									memmove(&str[select], &str[select + 1], len - select - 1);
 									str[len - 1] = '\0';
 
-								} else if (wParam == 0x4b) { // カーソルから行末まで削除する
+								} else if (wParam == 0x4b) { // \x83J\x81[\x83\\x83\x8B\x82\xA9\x82\xE7\x8Ds\x96\x96\x82܂ō폜\x82\xB7\x82\xE9
 									str[select] = '\0';
 
 								}
 							}
 
-							if (wParam == 0x55) { // カーソルより左側をすべて消す
+							if (wParam == 0x55) { // \x83J\x81[\x83\\x83\x8B\x82\xE6\x82荶\x91\xA4\x82\xF0\x82\xB7\x82ׂď\xC1\x82\xB7
 								if (select >= len) {
 									str[0] = '\0';
 								} else {
@@ -325,7 +325,7 @@
 			}
 			break;
 
-		// 上のキーを押した結果送られる文字で音が鳴るので捨てる
+		// \x8F\xE3\x82̃L\x81[\x82\xF0\x89\x9F\x82\xB5\x82\xBD\x8C\x8B\x89ʑ\x97\x82\xE7\x82\xEA\x82镶\x8E\x9A\x82ʼn\xB9\x82\xAA\x96‚\xE9\x82̂Ŏ̂Ă\xE9
 		case WM_CHAR:
 			switch (wParam) {
 				case 0x01:
@@ -361,7 +361,7 @@
 	return Result;
 }
 
-// C-n/C-p のためにサブクラス化
+// C-n/C-p \x82̂\xBD\x82߂ɃT\x83u\x83N\x83\x89\x83X\x89\xBB
 void SetEditboxSubclass(HWND hDlg, int nID, BOOL ComboBox)
 {
 	EditSubclassData *data;
@@ -379,18 +379,24 @@
 
 typedef struct {
 	BOOL found;
-	const TCHAR *face;
+	const wchar_t *face;
 	BYTE charset;
-} IsExistFontInfo;
+} IsExistFontInfoW;
 
-int CALLBACK IsExistFontSub(
-	ENUMLOGFONT* lpelf, NEWTEXTMETRIC* lpntm,
+typedef struct {
+	BOOL found;
+	const char *face;
+	BYTE charset;
+} IsExistFontInfoA;
+
+int CALLBACK IsExistFontSubW(
+	ENUMLOGFONTW* lpelf, NEWTEXTMETRICW* lpntm,
 	int nFontType, LPARAM lParam)
 {
-	IsExistFontInfo *info = (IsExistFontInfo *)lParam;
+	IsExistFontInfoW *info = (IsExistFontInfoW *)lParam;
 	(void)lpntm;
 	if (nFontType != DEVICE_FONTTYPE &&
-		_tcsicmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
+		_wcsicmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
 		lpelf->elfLogFont.lfCharSet == info->charset)
 	{
 		info->found = TRUE;
@@ -399,127 +405,81 @@
 	return 1;
 }
 
+int CALLBACK IsExistFontSubA(
+	ENUMLOGFONTA* lpelf, NEWTEXTMETRICA* lpntm,
+	int nFontType, LPARAM lParam)
+{
+	IsExistFontInfoA *info = (IsExistFontInfoA *)lParam;
+	(void)lpntm;
+	if (nFontType != DEVICE_FONTTYPE &&
+		_stricmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
+		lpelf->elfLogFont.lfCharSet == info->charset)
+	{
+		info->found = TRUE;
+		return 0;
+	}
+	return 1;
+}
+
 /**
- *	フォントがインストールされているか調べる
+ *	\x83t\x83H\x83\x93\x83g\x82\xAA\x83C\x83\x93\x83X\x83g\x81[\x83\x8B\x82\xB3\x82\xEA\x82Ă\xA2\x82邩\x92\xB2\x82ׂ\xE9
  */
-BOOL IsExistFont(const TCHAR *face, BYTE charset, BOOL strict)
+BOOL IsExistFont(const wchar_t *face, BYTE charset, BOOL strict)
 {
 	HDC hDC = GetDC(NULL);
-	LOGFONT lf;
-	IsExistFontInfo info;
-	(void)face;
-	(void)charset;
+	LOGFONTW lf;
+	IsExistFontInfoW info;
 	memset(&lf, 0, sizeof(lf));
 	lf.lfCharSet = strict ? DEFAULT_CHARSET : charset;
-	// ↑DEFAULT_CHARSETとするとフォントリンクも有効になるようだ
+	// \x81\xAADEFAULT_CHARSET\x82Ƃ\xB7\x82\xE9\x82ƃt\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82\xE0\x97L\x8C\xF8\x82ɂȂ\xE9\x82悤\x82\xBE
 	lf.lfPitchAndFamily = 0;
 	info.found = FALSE;
 	info.face = face;
 	info.charset = charset;
-	EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)IsExistFontSub, (LPARAM)&info, 0);
+	EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)IsExistFontSubW, (LPARAM)&info, 0);
 	ReleaseDC(NULL, hDC);
 	return info.found;
 }
 
-/**
- *	使用するCharSetを取得する
- */
-#if 0
-DWORD GetCharSet()
+BOOL IsExistFontA(const char *face, BYTE charset, BOOL strict)
 {
-	DWORD codepage;
-	CHARSETINFO charset_info;
-	BOOL result;
-
-#if 0
-	TCHAR codepage_str[16];
-	int ri = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
-						  (LPSTR)&codepage_str, _countof(codepage_str));
-	if (ri == 0) {
-		return 0;
-	}
-	codepage = _ttoi(codepage_str);
-#else
-	codepage = GetACP();
-#endif
-
-	result = TranslateCharsetInfo((DWORD *)codepage, &charset_info, TCI_SRCCODEPAGE);
-	assert(result == TRUE);
-	if (result == FALSE) {
-		return SHIFTJIS_CHARSET;
-	}
-
-	return charset_info.ciCharset;
+	HDC hDC = GetDC(NULL);
+	LOGFONTA lf;
+	IsExistFontInfoA info;
+	memset(&lf, 0, sizeof(lf));
+	lf.lfCharSet = strict ? DEFAULT_CHARSET : charset;
+	// \x81\xAADEFAULT_CHARSET\x82Ƃ\xB7\x82\xE9\x82ƃt\x83H\x83\x93\x83g\x83\x8A\x83\x93\x83N\x82\xE0\x97L\x8C\xF8\x82ɂȂ\xE9\x82悤\x82\xBE
+	lf.lfPitchAndFamily = 0;
+	info.found = FALSE;
+	info.face = face;
+	info.charset = charset;
+	EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)IsExistFontSubA, (LPARAM)&info, 0);
+	ReleaseDC(NULL, hDC);
+	return info.found;
 }
-#endif
 
 /**
- *	使用するダイアログフォントの候補
+ *	\x8Eg\x97p\x82\xB7\x82\xE9\x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g\x82\xF0\x8C\x88\x92肷\x82\xE9
  */
-#if 0
-typedef struct {
-	const TCHAR *face;
-	LONG height;
-} DialogFontLists;
-
-const DialogFontLists *GetDialogFontCandidate(BYTE char_set)
+void SetDialogFont(const char *SetupFName,
+				   const char *UILanguageFile, const char *Section)
 {
-	switch (char_set) {
-	case SHIFTJIS_CHARSET: {
-		static const DialogFontLists list[] = {
-			{ _T("Yu Gothic UI"), -9 },
-			{ _T("Meiryo UI"), -9 }, 	// Vista以降
-			{ _T("MS UI Gothic"), -9 },	// 98以降
-			{ _T("MS ゴシック"), -9 },	// Windows 3.1以降
-			0
-		};
-		return list;
+	// teraterm.ini\x82̎w\x92\xE8
+	if (SetupFName != NULL) {
+		LOGFONTA logfont;
+		BOOL result;
+		result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName);
+		if (result == TRUE) {
+			result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE);
+			if (result == TRUE) {
+				TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
+				return;
+			}
+		}
 	}
-	case HANGUL_CHARSET: {
-		// Korean
-		static const DialogFontLists list[] = {
-			{ _T("돋움"), -9 },
-			{ _T("굴림"), -10 },
-			0
-		};
-		return list;
-	}
-	case GB2312_CHARSET: {
-		// Simplified Chinese
-		static const DialogFontLists list[] = {
-			{ _T("微软雅黑") , -8 },
-			{ _T("微软雅黑") , -10 },
-			0
-		};
-		return list;
-	}
-	case CHINESEBIG5_CHARSET: {
-		// Traditional Chinese
-		static const DialogFontLists list[] = {
-			{ _T("細明體") , -8 },
-			{ _T("新細明體") , -10 },
-			0
-		};
-		return list;
-	}
-	default: {
-		static const DialogFontLists list[] = {
-			{ _T("Tahoma"), -8 },
-			0
-		};
-		return list;
-	}
-	}
-}
-#endif
 
-/**
- *	使用するダイアログフォントを決定する
- */
-void SetDialogFont(const char *section, const char *UILanguageFile)
-{
-	// 明示的に指定されている場合はそれに従う
-	{
+	// .lng\x82̎w\x92\xE8
+	if (UILanguageFile != NULL) {
 		static const char *dlg_font_keys[] = {
 			"DLG_FONT",
 			"DLG_TAHOMA_FONT",
@@ -527,44 +487,45 @@
 		};
 		BOOL result = FALSE;
 		LOGFONTA logfont;
-		int i;
-		if (section != NULL) {
+		size_t i;
+		if (Section != NULL) {
 			for (i = 0; i < _countof(dlg_font_keys); i++) {
-				result = GetI18nLogfont(section, dlg_font_keys[i], &logfont, 72, UILanguageFile);
-				if (result == TRUE) {
+				result = GetI18nLogfont(Section, dlg_font_keys[i], &logfont, 0, UILanguageFile);
+				if (result == FALSE) {
+					continue;
+				}
+				if (logfont.lfFaceName[0] == '\0') {
 					break;
 				}
+				if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
+					break;
+				}
 			}
 		}
 		if (result == FALSE) {
 			for (i = 0; i < _countof(dlg_font_keys); i++) {
-				result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 72, UILanguageFile);
-				if (result == TRUE) {
+				result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 0, UILanguageFile);
+				if (result == FALSE) {
+					continue;
+				}
+				if (logfont.lfFaceName[0] == '\0') {
 					break;
 				}
+				if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
+					break;
+				}
 			}
 		}
 		if (result == TRUE) {
-#if defined(UNICODE)
-			wchar_t face[LF_FACESIZE];
-			MultiByteToWideChar(CP_ACP, 0, logfont.lfFaceName, -1, face, LF_FACESIZE);
-			if (IsExistFont(face, logfont.lfCharSet, FALSE)) {
-				TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
-				return;
-			}
-#else
-			if (IsExistFont(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
-				TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
-				return;
-			}
-#endif
-			// フォントが見つからなかったとき、
-			// 文字化けで正しく表示されない事態となる
-			// messagebox()のフォントをとりあえず選択しておく
+			TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
+			return;
 		}
+		// \x83t\x83H\x83\x93\x83g\x82\xAA\x8C\xA9\x82‚\xA9\x82\xE7\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB\x81A
+		// \x95\xB6\x8E\x9A\x89\xBB\x82\xAF\x82Ő\xB3\x82\xB5\x82\xAD\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x8E\x96\x91ԂƂȂ\xE9
+		// messagebox()\x82̃t\x83H\x83\x93\x83g\x82\xF0\x82Ƃ肠\x82\xA6\x82\xB8\x91I\x91\xF0\x82\xB5\x82Ă\xA8\x82\xAD
 	}
 
-	// messageboxのフォントを選択
+	// messagebox\x82̃t\x83H\x83\x93\x83g\x82\xF0\x91I\x91\xF0
 	{
 		NONCLIENTMETRICS nci;
 		int st_size = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont);
@@ -577,6 +538,6 @@
 		assert(r == TRUE);
 		logfont = &nci.lfStatusFont;
 
-		TTSetDlgFont(logfont->lfFaceName, /*logfont->lfHeight*/ -9, logfont->lfCharSet);
+		TTSetDlgFont(logfont->lfFaceName, logfont->lfHeight, logfont->lfCharSet);
 	}
 }

Modified: branches/cmake/teraterm/common/dlglib.h
===================================================================
--- branches/cmake/teraterm/common/dlglib.h	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/common/dlglib.h	2019-01-10 14:20:14 UTC (rev 7386)
@@ -88,7 +88,7 @@
 	LPCTSTR lpTemplateName,
 	HWND hWndParent,
 	DLGPROC lpDialogFunc);
-void SetDialogFont(const char *section, const char *UILanguageFile);
+void SetDialogFont(const char *SetupFName, const char *UILanguageFile, const char *Section);
 
 #if defined(_UNICODE)
 #define TTSetDlgFont(p1,p2,p3)	TTSetDlgFontW(p1,p2,p3)

Modified: branches/cmake/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- branches/cmake/teraterm/common/dlglib_tmpl.cpp	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/common/dlglib_tmpl.cpp	2019-01-10 14:20:14 UTC (rev 7386)
@@ -163,7 +163,7 @@
 		}
 		src += extraCount;
 	}
-	
+
 	size = (size + 1) & ~1;
 	return size;
 }
@@ -205,7 +205,7 @@
 			// \x8E擾
 			if (logfont != NULL) {
 				memset(logfont, 0, sizeof(*logfont));
-				logfont->lfHeight = -(*src++);
+				logfont->lfHeight = *src++;
 				t = CopySz(src, (WORD *)(&logfont->lfFaceName[0]));
 			} else {
 				src++;
@@ -215,7 +215,7 @@
 		} else {
 			// \x83Z\x83b\x83g
 			if (logfont != NULL) {
-				*dest++ = (WORD)(-logfont->lfHeight);
+				*dest++ = (WORD)logfont->lfHeight;
 				src += 1;
 				t = CopySz((WORD *)(&logfont->lfFaceName[0]), dest);
 				dest += t;
@@ -276,7 +276,7 @@
 		}
 		src += extraCount;
 	}
-	
+
 	size = (size + 1) & ~1;
 	return size;
 }
@@ -322,7 +322,7 @@
 			// \x8E擾
 			if (logfont != NULL) {
 				memset(logfont, 0, sizeof(*logfont));
-				logfont->lfHeight = -(*src++);
+				logfont->lfHeight = *src++;
 				logfont->lfWeight = *src++;
 				logfont->lfItalic = *((BYTE *)src);
 				logfont->lfCharSet = *(((BYTE *)src)+1);
@@ -338,7 +338,7 @@
 		} else {
 			// \x83Z\x83b\x83g
 			if (logfont != NULL) {
-				*dest++ = (WORD)(-logfont->lfHeight);
+				*dest++ = (WORD)logfont->lfHeight;
 				*dest++ = (WORD)logfont->lfWeight;
 				*((BYTE *)dest) = logfont->lfItalic;
 				*(((BYTE *)dest)+1) = logfont->lfCharSet;

Modified: branches/cmake/teraterm/common/i18n.c
===================================================================
--- branches/cmake/teraterm/common/i18n.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/common/i18n.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -82,32 +82,14 @@
 #endif
 }
 
-static void GetMessageBoxFontName(char *FontName)
-{
-	NONCLIENTMETRICSA nci;
-#if(WINVER >= 0x0600)
-	int st_size = offsetof(NONCLIENTMETRICSA, iPaddedBorderWidth);
-#else
-	int st_size = sizeof(NONCLIENTMETRICSA);
-#endif
-	BOOL r;
-	const LOGFONTA *logfont;
-
-	memset(&nci, 0, sizeof(nci));
-	nci.cbSize = st_size;
-	r = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, st_size, &nci, 0);
-	assert(r == TRUE);
-	logfont = &nci.lfStatusFont;
-
-	strcpy(FontName, logfont->lfFaceName);
-}
-
 DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile)
 {
-	static char tmp[MAX_UIMSG];
-	static char font[LF_FACESIZE];
-	int hight, charset;
+	char tmp[MAX_UIMSG];
+	char font[LF_FACESIZE];
+	int height, charset;
 	assert(iniFile[0] != '\0');
+	memset(logfont, 0, sizeof(*logfont));
+
 	GetPrivateProfileStringA(section, key, "", tmp, MAX_UIMSG, iniFile);
 	if (tmp[0] == '\0') {
 		return FALSE;
@@ -114,17 +96,18 @@
 	}
 
 	GetNthString(tmp, 1, LF_FACESIZE-1, font);
-	GetNthNum(tmp, 2, &hight);
+	GetNthNum(tmp, 2, &height);
 	GetNthNum(tmp, 3, &charset);
 
-	memset(logfont, 0, sizeof(*logfont));
-	if (font[0] == '\0') {
-		GetMessageBoxFontName(logfont->lfFaceName);
-	} else {
+	if (font[0] != '\0') {
 		strncpy_s(logfont->lfFaceName, sizeof(logfont->lfFaceName), font, _TRUNCATE);
 	}
 	logfont->lfCharSet = (BYTE)charset;
-	logfont->lfHeight = MulDiv(hight, -ppi, 72);
+	if (ppi != 0) {
+		logfont->lfHeight = MulDiv(height, -ppi, 72);
+	} else {
+		logfont->lfHeight = height;
+	}
 	logfont->lfWidth = 0;
 
 	return TRUE;

Modified: branches/cmake/teraterm/common/tt_res.h
===================================================================
--- branches/cmake/teraterm/common/tt_res.h	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/common/tt_res.h	2019-01-10 14:20:14 UTC (rev 7386)
@@ -289,6 +289,7 @@
 #define ID_SETUP_TERMINAL               50310
 #define ID_SETUP_WINDOW                 50320
 #define ID_SETUP_FONT                   50330
+#define ID_SETUP_DLG_FONT               50331
 #define ID_SETUP_KEYBOARD               50340
 #define ID_SETUP_SERIALPORT             50350
 #define ID_SETUP_TCPIP                  50360

Modified: branches/cmake/teraterm/teraterm/teraterm.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraterm.cpp	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp	2019-01-10 14:20:14 UTC (rev 7386)
@@ -246,7 +246,7 @@
 	CVTWindow *m_pMainWnd = new CVTWindow();
 	pVTWin = m_pMainWnd;
 	main_window = m_pMainWnd->m_hWnd;
-	SetDialogFont(NULL, ts.UILanguageFile);
+	SetDialogFont(ts.SetupFName, ts.UILanguageFile, NULL);
 
 	MSG msg;
 	while (GetMessage(&msg, NULL, 0, 0)) {

Modified: branches/cmake/teraterm/teraterm/ttermpro.rc
===================================================================
--- branches/cmake/teraterm/teraterm/ttermpro.rc	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/teraterm/ttermpro.rc	2019-01-10 14:20:14 UTC (rev 7386)
@@ -582,7 +582,11 @@
     BEGIN
         MENUITEM "&Terminal...",                ID_SETUP_TERMINAL
         MENUITEM "&Window...",                  ID_SETUP_WINDOW
-        MENUITEM "&Font...",                    ID_SETUP_FONT
+		POPUP "&Font"
+        BEGIN
+			MENUITEM "&Font...",                ID_SETUP_FONT
+			MENUITEM "&Dialog Font...",         ID_SETUP_DLG_FONT
+		END
         MENUITEM "&Keyboard...",                ID_SETUP_KEYBOARD
         MENUITEM "S&erial port...",             ID_SETUP_SERIALPORT
         MENUITEM "T&CP/IP...",                  ID_SETUP_TCPIP

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2019-01-10 14:20:14 UTC (rev 7386)
@@ -105,10 +105,12 @@
 #define CreateProcessT CreateProcessW
 #define GetStartupInfoT GetStartupInfoW
 #define STARTUPINFOT STARTUPINFOW
+#define SetDlgItemTextT SetDlgItemTextW
 #else
 #define CreateProcessT CreateProcessA
 #define GetStartupInfoT GetStartupInfoA
 #define STARTUPINFOT STARTUPINFOA
+#define SetDlgItemTextT SetDlgItemTextA
 #endif
 
 #ifdef _DEBUG
@@ -1236,10 +1238,12 @@
 		{ ID_EDIT_SELECTSCREEN, "MENU_EDIT_SELECTSCREEN" },
 		{ ID_EDIT_SELECTALL, "MENU_EDIT_SELECTALL" },
 	};
-	static const DlgTextInfo SetupMenuTextInfo1[] = {
+	static const DlgTextInfo SetupMenuTextInfo[] = {
 		{ ID_SETUP_TERMINAL, "MENU_SETUP_TERMINAL" },
 		{ ID_SETUP_WINDOW, "MENU_SETUP_WINDOW" },
+		{ 2, "MENU_SETUP_FONT" },
 		{ ID_SETUP_FONT, "MENU_SETUP_FONT" },
+		{ ID_SETUP_DLG_FONT, "MENU_SETUP_DLG_FONT" },
 		{ ID_SETUP_KEYBOARD, "MENU_SETUP_KEYBOARD" },
 		{ ID_SETUP_SERIALPORT, "MENU_SETUP_SERIALPORT" },
 		{ ID_SETUP_TCPIP, "MENU_SETUP_TCPIP" },
@@ -1250,7 +1254,7 @@
 		{ ID_OPEN_SETUP, "MENU_SETUP_OPENSETUP" },
 		{ ID_SETUP_LOADKEYMAP, "MENU_SETUP_LOADKEYMAP" },
 	};
-	static const DlgTextInfo ControlMenuTextInfo1[] = {
+	static const DlgTextInfo ControlMenuTextInfo[] = {
 		{ ID_CONTROL_RESETTERMINAL, "MENU_CONTROL_RESET" },
 		{ ID_CONTROL_RESETREMOTETITLE, "MENU_CONTROL_RESETTITLE" },
 		{ ID_CONTROL_AREYOUTHERE, "MENU_CONTROL_AREYOUTHERE" },
@@ -1298,8 +1302,8 @@
 
 	SetDlgMenuTexts(FileMenu, FileMenuTextInfo, _countof(FileMenuTextInfo), ts.UILanguageFile);
 	SetDlgMenuTexts(hMenu, EditMenuTextInfo, _countof(EditMenuTextInfo), ts.UILanguageFile);
-	SetDlgMenuTexts(hMenu, SetupMenuTextInfo1, _countof(SetupMenuTextInfo1), ts.UILanguageFile);
-	SetDlgMenuTexts(hMenu, ControlMenuTextInfo1, _countof(ControlMenuTextInfo1), ts.UILanguageFile);
+	SetDlgMenuTexts(SetupMenu, SetupMenuTextInfo, _countof(SetupMenuTextInfo), ts.UILanguageFile);
+	SetDlgMenuTexts(hMenu, ControlMenuTextInfo, _countof(ControlMenuTextInfo), ts.UILanguageFile);
 	SetDlgMenuTexts(hMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
 
 	TTXModifyMenu(hMenu); /* TTPLUG */
@@ -4491,6 +4495,51 @@
 	DispSetupFontDlg();
 }
 
+static BOOL CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+	if (Message == WM_INITDIALOG) {
+		TCHAR uimsg[MAX_UIMSG];
+		get_lang_msgT("DLG_CHOOSEFONT_STC6", uimsg, _countof(uimsg),
+					  _T("\"Font style\" selection here won't affect actual font appearance."), ts.UILanguageFile);
+		SetDlgItemTextT(Dialog, stc6, uimsg);
+	}
+	return FALSE;
+}
+
+void CVTWindow::OnSetupDlgFont()
+{
+	LOGFONTA LogFont;
+	CHOOSEFONTA cf;
+	BOOL result;
+	result = GetI18nLogfont("Tera Term", "DlgFont", &LogFont, 0, ts.SetupFName);
+	if (result == FALSE) {
+		memset(&LogFont, 0, sizeof(LogFont));
+	}
+
+	memset(&cf, 0, sizeof(cf));
+	cf.lStructSize = sizeof(cf);
+	cf.hwndOwner = HVTWin;
+	cf.lpLogFont = &LogFont;
+	cf.Flags =
+		CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT |
+		CF_SHOWHELP | CF_NOVERTFONTS |
+		CF_ENABLEHOOK;
+	if (ts.ListHiddenFonts) {
+		cf.Flags |= CF_INACTIVEFONTS;
+	}
+	cf.lpfnHook = (LPCFHOOKPROC)(&TFontHook);
+	cf.nFontType = REGULAR_FONTTYPE;
+	cf.hInstance = hInst;
+	HelpId = HlpSetupFont;
+	result = ChooseFontA(&cf);
+	if (result) {
+		char Temp[80];
+		_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d",
+					LogFont.lfFaceName, LogFont.lfHeight, LogFont.lfCharSet);
+		WritePrivateProfileStringA("Tera Term", "DlgFont", Temp, ts.SetupFName);
+	}
+}
+
 void CVTWindow::OnSetupKeyboard()
 {
 	BOOL Ok;
@@ -6265,6 +6314,7 @@
 		case ID_SETUP_TERMINAL: OnSetupTerminal(); break;
 		case ID_SETUP_WINDOW: OnSetupWindow(); break;
 		case ID_SETUP_FONT: OnSetupFont(); break;
+		case ID_SETUP_DLG_FONT: OnSetupDlgFont(); break;
 		case ID_SETUP_KEYBOARD: OnSetupKeyboard(); break;
 		case ID_SETUP_SERIALPORT: OnSetupSerialPort(); break;
 		case ID_SETUP_TCPIP: OnSetupTCPIP(); break;

Modified: branches/cmake/teraterm/teraterm/vtwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.h	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/teraterm/vtwin.h	2019-01-10 14:20:14 UTC (rev 7386)
@@ -197,6 +197,7 @@
 	afx_msg void OnSetupTerminal();
 	afx_msg void OnSetupWindow();
 	afx_msg void OnSetupFont();
+	afx_msg void OnSetupDlgFont();
 	afx_msg void OnSetupKeyboard();
 	afx_msg void OnSetupSerialPort();
 	afx_msg void OnSetupTCPIP();

Modified: branches/cmake/teraterm/ttpdlg/ttdlg.c
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttdlg.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/ttpdlg/ttdlg.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -80,6 +80,7 @@
 
 //static HANDLE hInst;
 extern HANDLE hInst;
+extern TTTSet ts;
 
 static char UILanguageFile[MAX_PATH];
 
@@ -2777,7 +2778,7 @@
 		i = IDD_TERMDLG;
 	}
 
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(i),
@@ -2786,7 +2787,7 @@
 
 DllExport BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_WINDLG),
@@ -2795,7 +2796,7 @@
 
 DllExport BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_KEYBDLG),
@@ -2804,7 +2805,7 @@
 
 DllExport BOOL WINAPI _SetupSerialPort(HWND WndParent, PTTSet ts)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_SERIALDLG),
@@ -2813,7 +2814,7 @@
 
 DllExport BOOL WINAPI _SetupTCPIP(HWND WndParent, PTTSet ts)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_TCPIPDLG),
@@ -2822,7 +2823,7 @@
 
 DllExport BOOL WINAPI _GetHostName(HWND WndParent, PGetHNRec GetHNRec)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_HOSTDLG),
@@ -2831,7 +2832,7 @@
 
 DllExport BOOL WINAPI _ChangeDirectory(HWND WndParent, PCHAR CurDir)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_DIRDLG),
@@ -2840,7 +2841,7 @@
 
 DllExport BOOL WINAPI _AboutDialog(HWND WndParent)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBox(hInst,
 		                MAKEINTRESOURCE(IDD_ABOUTDLG),
@@ -2897,8 +2898,8 @@
 	CHOOSEFONTA cf;
 	BOOL Ok;
 
-	memset(&cf, 0, sizeof(CHOOSEFONT));
-	cf.lStructSize = sizeof(CHOOSEFONT);
+	memset(&cf, 0, sizeof(cf));
+	cf.lStructSize = sizeof(cf);
 	cf.hwndOwner = WndParent;
 	cf.lpLogFont = LogFont;
 	cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT |
@@ -2917,7 +2918,7 @@
 
 DllExport BOOL WINAPI _SetupGeneral(HWND WndParent, PTTSet ts)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
 	return
 		(BOOL)DialogBoxParam(hInst,
 		                     MAKEINTRESOURCE(IDD_GENDLG),
@@ -2926,7 +2927,7 @@
 
 DllExport BOOL WINAPI _WindowWindow(HWND WndParent, PBOOL Close)
 {
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
 	*Close = FALSE;
 	return
 		(BOOL)DialogBoxParam(hInst,

Modified: branches/cmake/teraterm/ttpmacro/ttmacro.cpp
===================================================================
--- branches/cmake/teraterm/ttpmacro/ttmacro.cpp	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/teraterm/ttpmacro/ttmacro.cpp	2019-01-10 14:20:14 UTC (rev 7386)
@@ -137,7 +137,7 @@
 	init();
 	InitCommonControls();
 	GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
-	SetDialogFont(NULL, UILanguageFile);
+	SetDialogFont(NULL, UILanguageFile, NULL);
 
 	Busy = TRUE;
 	pCCtrlWindow = new CCtrlWindow();

Modified: branches/cmake/ttssh2/ttxssh/CMakeLists.txt
===================================================================
--- branches/cmake/ttssh2/ttxssh/CMakeLists.txt	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/ttssh2/ttxssh/CMakeLists.txt	2019-01-10 14:20:14 UTC (rev 7386)
@@ -1,170 +1,170 @@
-project(ttxssh)
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
-
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake)
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake)
-
-if(USE_UNICODE_API)
-  add_definitions(-DUNICODE -D_UNICODE)
-endif()
-
-set(COMMON_SRC
-  ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
-  ../../teraterm/common/ttcommon.h
-  ../../teraterm/common/i18n.h
-  ../../teraterm/common/ttlib.h
-  ../../teraterm/common/dlglib.h
-  ../../teraterm/common/dlglib.c
-  ../../teraterm/common/dlglib_cpp.cpp
-  ../../teraterm/common/dlglib_tmpl.cpp
-  ../../teraterm/common/servicenames.h
-  ../../teraterm/common/codeconv.cpp
-  ../../teraterm/common/codeconv.h
-  )
-
-source_group(
-  "common"
-  FILES
-  ${COMMON_SRC}
-  )
-
-set(SRC
-  ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
-  ../matcher/matcher.c
-  arc4random.c
-  arc4random.h
-  auth.c
-  auth.h
-  buffer.c
-  buffer.h
-  chacha.c
-  chacha.h
-  cipher.h
-  cipher-ctr.c
-  config.h
-  crypt.c
-  crypt.h
-  dns.c
-  dns.h
-  ed25519.c
-  ed25519_bcrypt_pbkdf.c
-  ed25519_blf.h
-  ed25519_blocks.c
-  ed25519_blowfish.c
-  ed25519_crypto_api.h
-  ed25519_fe25519.c
-  ed25519_fe25519.h
-  ed25519_ge25519.c
-  ed25519_ge25519.h
-  ed25519_hash.c
-  ed25519_sc25519.c
-  ed25519_sc25519.h
-  ed25519_verify.c
-  fwd.c
-  fwd.h
-  fwd-socks.c
-  fwd-socks.h
-  fwdui.c
-  fwdui.h
-  hosts.c
-  hosts.h
-  kex.c
-  kex.h
-  key.c
-  key.h
-  keyfiles.c
-  keyfiles.h
-  pkt.c
-  pkt.h
-  resource.h
-  sftp.c
-  sftp.h
-  ssh.c
-  ssh.h
-  ttxssh.c
-  ttxssh.def
-  ttxssh.h
-  ttxssh.rc
-  ttxssh-version.h
-  ttxssh-version.rc
-  util.c
-  util.h
-  x11util.c
-  x11util.h
-  ${COMMON_SRC}
-  )
-
-
-include_directories(
-  ../../teraterm/teraterm
-  ../../teraterm/common
-  ../matcher
-  ../putty
-  ${OPENSSL_INCLUDE_DIRS}
-  ${ZLIB_INCLUDE_DIRS}
-  )
-
-link_directories(
-  ${ZLIB_LIBRARY_DIRS}
-  )
-
-if (MSVC)
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll")
-endif()
-
-if(MINGW)
-  link_directories(
-	${CMAKE_SOURCE_DIR}/teraterm/htmlhelp
-	)
-endif()
-
-add_library(
-  ttxssh SHARED
-  ${SRC}
-  )
-
-target_compile_definitions(
-  ttxssh
-  PRIVATE -DTTPCMN_IMPORT
-  )
-
-set_target_properties(
-  ttxssh
-  PROPERTIES
-  PREFIX ""
-  )
-
-target_link_libraries(
-  ttxssh
-  libputty
-  ttpcmn
-  debug zlibstaticd
-  optimized zlibstatic
-  ${OPENSSL_LIB}
-  #
-  ws2_32
-  dnsapi
-  gdi32
-  comdlg32
-  delayimp
-  )
-
-### create puttyversion.h
-
-file(READ "${CMAKE_SOURCE_DIR}/libs/putty/windows/putty.iss" iis)
-
-string(REGEX MATCH "VersionInfoTextVersion=([^\n]+)\n" _ ${iis})
-set(version_str ${CMAKE_MATCH_1})
-if("${version_str}" STREQUAL "")
-  string(REGEX MATCH "AppVerName=([^\n]+)\n" _ ${iis})
-  set(version_str ${CMAKE_MATCH_1})
-endif()
-if("${version_str}" STREQUAL "")
-  set(version_str "unknown")
-endif()
-message("putty version=\"${version_str}\"")
-FILE(
-  WRITE ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
-  "#define PUTTYVERSION \"${version_str}\"\n"
-  )
+project(ttxssh)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake)
+
+if(USE_UNICODE_API)
+  add_definitions(-DUNICODE -D_UNICODE)
+endif()
+
+set(COMMON_SRC
+  ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
+  ../../teraterm/common/ttcommon.h
+  ../../teraterm/common/i18n.h
+  ../../teraterm/common/ttlib.h
+  ../../teraterm/common/dlglib.h
+  ../../teraterm/common/dlglib.c
+  ../../teraterm/common/dlglib_cpp.cpp
+  ../../teraterm/common/dlglib_tmpl.cpp
+  ../../teraterm/common/servicenames.h
+  ../../teraterm/common/codeconv.cpp
+  ../../teraterm/common/codeconv.h
+  )
+
+source_group(
+  "common"
+  FILES
+  ${COMMON_SRC}
+  )
+
+set(SRC
+  ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
+  ../matcher/matcher.c
+  arc4random.c
+  arc4random.h
+  auth.c
+  auth.h
+  buffer.c
+  buffer.h
+  chacha.c
+  chacha.h
+  cipher.h
+  cipher-ctr.c
+  config.h
+  crypt.c
+  crypt.h
+  dns.c
+  dns.h
+  ed25519.c
+  ed25519_bcrypt_pbkdf.c
+  ed25519_blf.h
+  ed25519_blocks.c
+  ed25519_blowfish.c
+  ed25519_crypto_api.h
+  ed25519_fe25519.c
+  ed25519_fe25519.h
+  ed25519_ge25519.c
+  ed25519_ge25519.h
+  ed25519_hash.c
+  ed25519_sc25519.c
+  ed25519_sc25519.h
+  ed25519_verify.c
+  fwd.c
+  fwd.h
+  fwd-socks.c
+  fwd-socks.h
+  fwdui.c
+  fwdui.h
+  hosts.c
+  hosts.h
+  kex.c
+  kex.h
+  key.c
+  key.h
+  keyfiles.c
+  keyfiles.h
+  pkt.c
+  pkt.h
+  resource.h
+  sftp.c
+  sftp.h
+  ssh.c
+  ssh.h
+  ttxssh.c
+  ttxssh.def
+  ttxssh.h
+  ttxssh.rc
+  ttxssh-version.h
+  ttxssh-version.rc
+  util.c
+  util.h
+  x11util.c
+  x11util.h
+  ${COMMON_SRC}
+  )
+
+
+include_directories(
+  ../../teraterm/teraterm
+  ../../teraterm/common
+  ../matcher
+  ../putty
+  ${OPENSSL_INCLUDE_DIRS}
+  ${ZLIB_INCLUDE_DIRS}
+  )
+
+link_directories(
+  ${ZLIB_LIBRARY_DIRS}
+  )
+
+if (MSVC)
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll")
+endif()
+
+if(MINGW)
+  link_directories(
+	${CMAKE_SOURCE_DIR}/teraterm/htmlhelp
+	)
+endif()
+
+add_library(
+  ttxssh SHARED
+  ${SRC}
+  )
+
+target_compile_definitions(
+  ttxssh
+  PRIVATE -DTTPCMN_IMPORT
+  )
+
+set_target_properties(
+  ttxssh
+  PROPERTIES
+  PREFIX ""
+  )
+
+target_link_libraries(
+  ttxssh
+  libputty
+  ttpcmn
+  debug zlibstaticd
+  optimized zlibstatic
+  ${OPENSSL_LIB}
+  #
+  ws2_32
+  dnsapi
+  gdi32
+  comdlg32
+  delayimp
+  )
+
+### create puttyversion.h
+
+file(READ "${CMAKE_SOURCE_DIR}/libs/putty/windows/putty.iss" iis)
+
+string(REGEX MATCH "VersionInfoTextVersion=([^\n]+)\n" _ ${iis})
+set(version_str ${CMAKE_MATCH_1})
+if("${version_str}" STREQUAL "")
+  string(REGEX MATCH "AppVerName=([^\n]+)\n" _ ${iis})
+  set(version_str ${CMAKE_MATCH_1})
+endif()
+if("${version_str}" STREQUAL "")
+  set(version_str "unknown")
+endif()
+message("putty version=\"${version_str}\"")
+FILE(
+  WRITE ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
+  "#define PUTTYVERSION \"${version_str}\"\n"
+  )

Modified: branches/cmake/ttssh2/ttxssh/hosts.c
===================================================================
--- branches/cmake/ttssh2/ttxssh/hosts.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/ttssh2/ttxssh/hosts.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -997,7 +997,7 @@
 	}
 	{
 		const TCHAR *hostname = ToTcharU8(pvar->hosts_state.prefetched_hostname);
-		_tcsncpy_s(buf2 + i, sizeof(buf2) - i,
+		_tcsncpy_s(buf2 + i, _countof(buf2) - i,
 				   hostname, _TRUNCATE);
 		free((void *)hostname);
 	}
@@ -1004,7 +1004,7 @@
 	j = i + _tcslen(buf2 + i);
 	for (; buf[i] == '#'; i++) {
 	}
-	_tcsncpy_s(buf2 + j, sizeof(buf2) - j, buf + i, _TRUNCATE);
+	_tcsncpy_s(buf2 + j, _countof(buf2) - j, buf + i, _TRUNCATE);
 
 	SetDlgItemText(dlg, IDC_HOSTWARNING, buf2);
 

Modified: branches/cmake/ttssh2/ttxssh/ttxssh.c
===================================================================
--- branches/cmake/ttssh2/ttxssh/ttxssh.c	2019-01-10 14:19:57 UTC (rev 7385)
+++ branches/cmake/ttssh2/ttxssh/ttxssh.c	2019-01-10 14:20:14 UTC (rev 7386)
@@ -1715,7 +1715,7 @@
 
 static void UTIL_SetDialogFont()
 {
-	SetDialogFont("TTSSH", pvar->ts->UILanguageFile);
+	SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH");
 }
 
 static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)


Ttssh2-commit メーリングリストの案内