vcl/win/window/salframe.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
New commits: commit a7f0e7b40fff2238a5cb2bfac750b22d8d5ee15d Author: Jonathan Clark <[email protected]> AuthorDate: Mon May 26 14:51:53 2025 -0600 Commit: Jonathan Clark <[email protected]> CommitDate: Tue May 27 15:13:05 2025 +0200 tdf#147299 vcl: Set Microsoft ja IME to vertical mode in vertical text Fixes a Windows IME integration bug causing the Microsoft Japanese IME to display inappropriately rotated text or overlap the composition string when the text direction is vertical. Windows IMEs do not expose an explicit option to enable vertical writing. Instead, this mode is set by providing a font face with a leading '@' sign. This behavior is not documented, but is long-standing and is the standard convention on Windows in other contexts. Change-Id: I9ebe45cf2c48b5f175d369daaa891f86fdc77c27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185870 Tested-by: Jenkins Reviewed-by: Jonathan Clark <[email protected]> diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index fc1ce601db46..6ddc60713383 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2148,6 +2148,22 @@ static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pCont LOGFONTW aLogFont; ImplGetLogFontFromFontSelect(pContext->mpFont->GetFontSelectPattern(), nullptr, aLogFont, true); + + // tdf#147299: To enable vertical input mode, Windows IMEs check the face + // name string for a leading '@'. + SalExtTextInputPosEvent aPosEvt; + pFrame->CallCallback(SalEvent::ExtTextInputPos, &aPosEvt); + if (aPosEvt.mbVertical) + { + std::array<WCHAR, LF_FACESIZE> aTmpFaceName; + std::copy(aLogFont.lfFaceName, aLogFont.lfFaceName + LF_FACESIZE, + aTmpFaceName.begin()); + aLogFont.lfFaceName[0] = L'@'; + std::copy(aTmpFaceName.begin(), aTmpFaceName.end() - 1, + aLogFont.lfFaceName + 1); + aLogFont.lfFaceName[LF_FACESIZE - 1] = L' + } + ImmSetCompositionFontW( hIMC, &aLogFont ); ImmReleaseContext( pFrame->mhWnd, hIMC ); }
