Beispiel #1
0
bool xWnd32IMEInput::setCompositionFont(int hImc ,  const wchar_t* strFamilly, int nHeight , bool bBold , bool bItalic , bool bUnderLine)
{
	LOGFONTW logFont;
	logFont.lfHeight = -nHeight;
	logFont.lfWidth = 0;
	logFont.lfEscapement = 0;
	logFont.lfOrientation = 0;
	logFont.lfWeight = bBold ? 900 : 400;
	logFont.lfItalic = bItalic ? 1 : 0;
	logFont.lfUnderline = bUnderLine ? 1 : 0;
	logFont.lfStrikeOut = 0;
	logFont.lfCharSet = GB2312_CHARSET;
#ifndef _WIN32_WCE
	logFont.lfOutPrecision = OUT_TT_PRECIS;
#else
	logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
#endif
	logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
	logFont.lfQuality = 5;
	logFont.lfPitchAndFamily = FF_DONTCARE;
	wcscpy(logFont.lfFaceName,strFamilly);

	ImmSetCompositionFontW((HIMC)hImc, &logFont);
	return true;
}
Beispiel #2
0
static HRESULT WINAPI ActiveIMMApp_SetCompositionFontW(IActiveIMMApp* This,
        HIMC hIMC, LOGFONTW *plf)
{
    BOOL rc;

    rc = ImmSetCompositionFontW(hIMC,plf);

    if (rc)
        return S_OK;
    else
        return E_FAIL;
}
EXPORT BOOL SetInlinePosition(HWND hWnd, int x, int y, int font_height)
{
	BOOL ret = FALSE;
	HIMC hIMC = ImmGetContext(hWnd);

	if (ImmGetOpenStatus(hIMC)) {
		COMPOSITIONFORM cf = {0};
		cf.dwStyle = CFS_POINT;
		cf.ptCurrentPos.x = x;
		cf.ptCurrentPos.y = y;
		if (ImmSetCompositionWindow(hIMC, &cf)) {
			LOGFONTW lf = {0};
			lf.lfHeight = font_height;
			// lf.lfFaceName = font_face;
			if (ImmSetCompositionFontW(hIMC, &lf)) {
				ret = TRUE;
			}
		}
	}

	ImmReleaseContext(hWnd, hIMC);
	return ret;
}