[Ttssh2-commit] [7588] ダイアログフォントのサイズ指定を誤っていたので修正

scmno****@osdn***** scmno****@osdn*****
2019年 4月 13日 (土) 01:19:30 JST


Revision: 7588
          https://osdn.net/projects/ttssh2/scm/svn/commits/7588
Author:   zmatsuo
Date:     2019-04-13 01:19:30 +0900 (Sat, 13 Apr 2019)
Log Message:
-----------
ダイアログフォントのサイズ指定を誤っていたので修正

Modified Paths:
--------------
    trunk/teraterm/common/dlglib_tmpl.cpp
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- trunk/teraterm/common/dlglib_tmpl.cpp	2019-04-12 16:19:17 UTC (rev 7587)
+++ trunk/teraterm/common/dlglib_tmpl.cpp	2019-04-12 16:19:30 UTC (rev 7588)
@@ -446,6 +446,7 @@
  */
 void TTSetDlgFontW(const wchar_t *face, int height, int charset)
 {
+	assert(height > 0);
 	if (face != NULL) {
 		wcscpy_s(FontFaceName, face);
 	} else {
@@ -461,6 +462,7 @@
  */
 void TTSetDlgFontA(const char *face, int height, int charset)
 {
+	assert(height > 0);
 	if (face != NULL) {
 		MultiByteToWideChar(CP_ACP, 0, face, -1, FontFaceName, LF_FACESIZE);
 	} else {

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-04-12 16:19:17 UTC (rev 7587)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-04-12 16:19:30 UTC (rev 7588)
@@ -4694,9 +4694,14 @@
 	LOGFONTA LogFont;
 	CHOOSEFONTA cf;
 	BOOL result;
+
+	// LogFont.lfHeight \x82\xCD point
 	result = GetI18nLogfont("Tera Term", "DlgFont", &LogFont, 0, ts.SetupFName);
-	if (result == FALSE) {
-		memset(&LogFont, 0, sizeof(LogFont));
+	if (result == TRUE) {
+		// pixel\x82ɕϊ\xB7
+		LogFont.lfHeight = -GetFontPixelFromPoint(m_hWnd, LogFont.lfHeight);
+	} else {
+		GetMessageboxFont(&LogFont);
 	}
 
 	memset(&cf, 0, sizeof(cf));
@@ -4717,8 +4722,11 @@
 	result = ChooseFontA(&cf);
 	if (result) {
 		char Temp[80];
+		int font_point = cf.iPointSize / 10;	// point \x82ŕۑ\xB6\x82\xB7\x82\xE9
 		_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d",
-					LogFont.lfFaceName, LogFont.lfHeight, LogFont.lfCharSet);
+					LogFont.lfFaceName,
+					font_point,
+					LogFont.lfCharSet);
 		WritePrivateProfileStringA("Tera Term", "DlgFont", Temp, ts.SetupFName);
 
 		SetDialogFont(ts.SetupFName, ts.UILanguageFile, "TTSSH");


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