diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index d654699bf2..52e162aff0 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -656,11 +656,17 @@ static void IME_SetTextInputArea(SDL_VideoData *videodata, const SDL_Rect *rect, if (himc) { COMPOSITIONFORM cof; CANDIDATEFORM caf; + int font_height = rect->h; + + LOGFONTW font; + if (ImmGetCompositionFontW(himc, &font)) { + font_height = font.lfHeight; + } SDL_zero(cof); cof.dwStyle = CFS_RECT; cof.ptCurrentPos.x = rect->x + cursor; - cof.ptCurrentPos.y = rect->y; + cof.ptCurrentPos.y = rect->y + (rect->h - font_height) / 2; cof.rcArea.left = rect->x; cof.rcArea.right = (LONG)rect->x + rect->w; cof.rcArea.top = rect->y; @@ -1055,6 +1061,9 @@ SDL_bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam case IMN_SETCOMPOSITIONWINDOW: SDL_DebugIMELog("IMN_SETCOMPOSITIONWINDOW\n"); break; + case IMN_SETCOMPOSITIONFONT: + SDL_DebugIMELog("IMN_SETCOMPOSITIONFONT\n"); + break; case IMN_SETCANDIDATEPOS: SDL_DebugIMELog("IMN_SETCANDIDATEPOS\n"); break;