[Ttssh2-commit] [7878] IMEの変換中文字列のフォントが変化しないようにした

scmno****@osdn***** scmno****@osdn*****
2019年 7月 22日 (月) 23:32:46 JST


Revision: 7878
          https://osdn.net/projects/ttssh2/scm/svn/commits/7878
Author:   zmatsuo
Date:     2019-07-22 23:32:45 +0900 (Mon, 22 Jul 2019)
Log Message:
-----------
IMEの変換中文字列のフォントが変化しないようにした

- フォントの再設定をIME On時と候補ウィンドウオープン時に行う
- ResetConversionLogFont()#ttime.cを追加

チケット #39333

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/39333

Modified Paths:
--------------
    trunk/teraterm/teraterm/ttime.c
    trunk/teraterm/teraterm/ttime.h
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/ttime.c
===================================================================
--- trunk/teraterm/teraterm/ttime.c	2019-07-22 13:35:32 UTC (rev 7877)
+++ trunk/teraterm/teraterm/ttime.c	2019-07-22 14:32:45 UTC (rev 7878)
@@ -45,21 +45,6 @@
 #define free(p)		_free_dbg((p), _NORMAL_BLOCK)
 #endif
 
-// imm.h \x82\xAA include \x82ł\xAB\x82\xEA\x82\xCE _IMM_ \x82\xAA define \x82\xB3\x82\xEA\x82\xE9 \x81\xA8 \x82\xB1\x82̃u\x83\x8D\x83b\x83N\x95s\x97v?
-#ifndef _IMM_
-  #define _IMM_
-
-  typedef DWORD HIMC;
-
-  typedef struct tagCOMPOSITIONFORM {
-    DWORD dwStyle;
-    POINT ptCurrentPos;
-    RECT  rcArea;
-  } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, *LPCOMPOSITIONFORM;
-
-#define GCS_RESULTSTR 0x0800
-#endif //_IMM_
-
 // #define ENABLE_DUMP	1
 
 typedef LONG (WINAPI *TImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD);
@@ -182,13 +167,11 @@
   (*PImmReleaseContext)(HWnd,hIMC);
 }
 
-void SetConversionLogFont(HWND HWnd, PLOGFONTA lf)
+void ResetConversionLogFont(HWND HWnd)
 {
   HIMC	hIMC;
   if (HIMEDLL == NULL) return;
 
-  memcpy(&lfIME,lf,sizeof(LOGFONT));
-
   hIMC = (*PImmGetContext)(HWnd);
   // Set font for the conversion window
   (*PImmSetCompositionFont)(hIMC,&lfIME);
@@ -195,6 +178,14 @@
   (*PImmReleaseContext)(HWnd,hIMC);
 }
 
+void SetConversionLogFont(HWND HWnd, const LOGFONTA *lf)
+{
+  if (HIMEDLL == NULL) return;
+
+  memcpy(&lfIME,lf,sizeof(LOGFONT));
+  ResetConversionLogFont(HWnd);
+}
+
 // \x93\xE0\x95\x94\x97p
 static const char *GetConvStringA_i(HWND hWnd, DWORD index, size_t *len)
 {

Modified: trunk/teraterm/teraterm/ttime.h
===================================================================
--- trunk/teraterm/teraterm/ttime.h	2019-07-22 13:35:32 UTC (rev 7877)
+++ trunk/teraterm/teraterm/ttime.h	2019-07-22 14:32:45 UTC (rev 7878)
@@ -38,7 +38,8 @@
 void FreeIME(HWND hWnd);
 BOOL CanUseIME(void);
 void SetConversionWindow(HWND HWnd, int X, int Y);
-void SetConversionLogFont(HWND HWnd, PLOGFONTA lf);
+void SetConversionLogFont(HWND HWnd, const LOGFONTA *lf);
+void ResetConversionLogFont(HWND HWnd);
 BOOL GetIMEOpenStatus(HWND hWnd);
 void SetIMEOpenStatus(HWND hWnd, BOOL stat);
 const wchar_t *GetConvStringW(HWND hWnd, LPARAM lParam, size_t *len);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-07-22 13:35:32 UTC (rev 7877)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-07-22 14:32:45 UTC (rev 7878)
@@ -3125,12 +3125,19 @@
 
 		// IME\x82\xCCOn/Off\x82\xF0\x8E擾\x82\xB7\x82\xE9
 		IMEstat = GetIMEOpenStatus(HVTWin);
+		if (IMEstat != 0) {
+			// IME On
 
-		// \x8F\xF3\x91Ԃ\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9IME\x82̂\xBD\x82߂Ɉʒu\x82\xF0\x92ʒm\x82\xB7\x82\xE9
-		int CaretX = (CursorX-WinOrgX)*FontWidth;
-		int CaretY = (CursorY-WinOrgY)*FontHeight;
-		SetConversionWindow(HVTWin,CaretX,CaretY);
+			// \x8F\xF3\x91Ԃ\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9IME\x82̂\xBD\x82߂Ɉʒu\x82\xF0\x92ʒm\x82\xB7\x82\xE9
+			int CaretX = (CursorX-WinOrgX)*FontWidth;
+			int CaretY = (CursorY-WinOrgY)*FontHeight;
+			SetConversionWindow(HVTWin,CaretX,CaretY);
 
+			// \x83t\x83H\x83\x93\x83g\x82\xF0\x90ݒ肷\x82\xE9
+			ResetConversionLogFont(HVTWin);
+			OutputDebugPrintf("IMN_SETOPENSTATUS\n");
+		}
+
 		// \x95`\x89\xE6
 		ChangeCaret();
 
@@ -3151,11 +3158,33 @@
 	// \x8C\xF3\x95\xE2\x83E\x83B\x83\x93\x83h\x83E\x82\xAA\x95\\x8E\xA6\x82\xB3\x82ꂽ / \x95‚\xB6\x82\xBD\x82Ŕ\xAD\x90\xB6\x82\xB7\x82\xE9\x81B
 	case IMN_OPENCANDIDATE: {
 		// \x8C\xF3\x95\xE2\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8AJ\x82\xB1\x82\xA4\x82Ƃ\xB5\x82Ă\xA2\x82\xE9
+
+		// \x8F\xF3\x91Ԃ\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9IME\x82̂\xBD\x82߂Ɉʒu\x82\xF0\x92ʒm\x82\xB7\x82\xE9
+		// \x8E\x9F\x82̏ꍇ\x82\xAA\x82\xA0\x82\xE9\x82̂ŁA\x88ʒu\x82\xF0\x8DĐݒ肷\x82\xE9
+		// - \x8A\xBF\x8E\x9A\x95ϊ\xB7\x8C\xF3\x95\xE2\x82\xF0\x95\\x8E\xA6
+		// - \x8E\x9F\x82̕\xB6\x8E\x9A\x82\xF0\x93\xFC\x97͂\xB7\x82邱\x82ƂŊm\x92菈\x97\x9D\x82\xF0\x8Ds\x82\xA4
+		// - \x95\xB6\x8E\x9A\x93\xFC\x97͂Ɩ\xA2\x95ϊ\xB7\x95\xB6\x8E\x9A\x93\xFC\x97͂\xAA\x94\xAD\x90\xB6\x82\xB7\x82\xE9
 		int CaretX = (CursorX-WinOrgX)*FontWidth;
 		int CaretY = (CursorY-WinOrgY)*FontHeight;
 		SetConversionWindow(HVTWin,CaretX,CaretY);
+
+		// \x83t\x83H\x83\x93\x83g\x82\xF0\x90ݒ肷\x82\xE9
+		ResetConversionLogFont(HVTWin);
+
 		break;
 	}
+
+	case IMN_OPENSTATUSWINDOW: {
+		// \x83X\x83e\x81[\x83^\x83X\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83I\x81[\x83v\x83\x93(\x96\xA2\x8Am\x92蕶\x8E\x9A\x82\xF0\x95\\x8E\xA6?)\x82\xB5\x82悤\x82Ƃ\xB5\x82Ă\xA2\x82\xE9
+
+		// IME\x82Ŗ\xA2\x95ϊ\xB7\x8F\xF3\x91ԂŁA\x83t\x83H\x83\x93\x83g\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x83I\x81[\x83v\x83\x93\x82\xB5\x82ăN\x83\x8D\x81[\x83Y\x82\xB7\x82\xE9\x82\xC6
+		// IME\x82ɐݒ肵\x82Ă\xA2\x82\xBD\x83t\x83H\x83\x93\x83g\x82\xAA\x95ʂ̂\xE0\x82̂ɕω\xBB\x82\xB5\x82Ă\xA2\x82\xE9\x82炵\x82\xA2
+		// \x82\xB1\x82\xB1\x82Ńt\x83H\x83\x93\x83g\x82̍Đݒ\xE8\x82\xF0\x8Ds\x82\xA4
+
+		// \x83t\x83H\x83\x93\x83g\x82\xF0\x90ݒ肷\x82\xE9
+		ResetConversionLogFont(HVTWin);
+		break;
+	}
 	default:
 		break;
 	}


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