本文整理汇总了C++中TFont::GetFontSet方法的典型用法代码示例。如果您正苦于以下问题:C++ TFont::GetFontSet方法的具体用法?C++ TFont::GetFontSet怎么用?C++ TFont::GetFontSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFont
的用法示例。
在下文中一共展示了TFont::GetFontSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateInputContext
bool TWindow::CreateInputContext()
{
if (!fInputContext)
{
XIM xim = gApplication->GetInputMethod();
if (!xim)
return false;
XIMStyles* supportedStyles;
XGetIMValues(xim, XNQueryInputStyle, &supportedStyles, NULL, NULL);
if (!supportedStyles || supportedStyles->count_styles == 0)
return false;
XIMStyle* bestStyle = NULL;
for (unsigned short i = 0; i < supportedStyles->count_styles; i++)
{
XIMStyle* style = &supportedStyles->supported_styles[i];
// first check to see if it is supported
if ((*style & (XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone)) &&
(*style & ( /*XIMStatusCallbacks |*/ XIMStatusNothing | XIMStatusNone)))
{
if (bestStyle)
{
if (((*style & XIMPreeditPosition) && !(*bestStyle & XIMPreeditPosition)) ||
((*style & XIMStatusCallbacks) && !(*bestStyle & XIMStatusCallbacks)))
bestStyle = style;
else if (((*style & XIMPreeditNothing) && !(*bestStyle & (XIMPreeditPosition | XIMPreeditNothing))) ||
((*style & XIMStatusNothing) && !(*bestStyle & (XIMStatusCallbacks | XIMStatusNothing))))
bestStyle = style;
}
else
bestStyle = style;
}
}
XIMStyle style = (bestStyle ? *bestStyle : 0);
XFree(supportedStyles);
if (!bestStyle)
return false;
XPoint point;
point.x = point.y = 0;
XRectangle rect;
rect.x = rect.y = 0;
rect.width = rect.height = 0x7fff;
TFont* font = GetFont();
ASSERT(font && font->GetFontSet());
XVaNestedList preeditAttributes = XVaCreateNestedList(0, XNFontSet, font->GetFontSet(), XNSpotLocation, &point, XNArea, &rect, NULL);
ASSERT(preeditAttributes);
// XVaNestedList statusAttributes = XVaCreateNestedList(0, XNFontSet, font->GetFontSet(), NULL);
// ASSERT(statusAttributes);
XIC xic = XCreateIC(xim, XNInputStyle, style, XNClientWindow, fWindow, XNFocusWindow, fWindow, XNPreeditAttributes, preeditAttributes, /*XNStatusAttributes, statusAttributes, */ NULL);
if (xic)
fInputContext = new TInputContext(xic);
/*if (fInputContext)
{
long mask;
XGetICValues(fInputContext->GetXIC(), XNFilterEvents, &mask, NULL);
printf("XIC mask = %lx\n", mask);
}*/
}
return (fInputContext != NULL);
}