private void SetIMEWindowFont(Font f)
{
if (disableIME || hIMEWnd == IntPtr.Zero) return;
if (lf == null) {
lf = new LOGFONT();
f.ToLogFont(lf);
lf.lfFaceName = f.Name; // This is very important! "Font.ToLogFont" Method sets invalid value to LOGFONT.lfFaceName
}
try {
SendMessage(
hIMEWnd,
WM_IME_CONTROL,
new IntPtr(IMC_SETCOMPOSITIONFONT),
lf
);
} catch (AccessViolationException ex) {
Handle(ex);
}
}