コード例 #1
0
ファイル: CALabel.cpp プロジェクト: lmxing1987/CrossApp
void CALabel::applyStyle(const CALabelStyle* pLabelStyle)
{
	CC_RETURN_IF(!pLabelStyle);

	setFontName(pLabelStyle->getFontName());
	setFontSize(pLabelStyle->getFontSize());
	setColor(pLabelStyle->getFontColor());
	setLineSpacing(pLabelStyle->getLineSpace());
	setBold(pLabelStyle->isBold());
	setItalics(pLabelStyle->isItalics());
	setWordWrap(pLabelStyle->isWordWrap());
}
コード例 #2
0
void XtgScanner::setFont()
{
	/** define/apply font */
	flushText();
	token = getToken();
	curFontUsed = (*(doc->AllFonts)).value(token);
	if (curFontUsed.isNone())
	{
		QList<QString> List = ((*(doc->AllFonts)).keys());
		QStringList filter = static_cast<QStringList>(List).filter(token);
		if (!filter.empty())
			List = filter;
		FontSelect *f = new FontSelect(static_cast<QStringList>(List));
		if (f->exec())
			token = f->setFont();
		delete f;
	}
	curFontUsed = (*(doc->AllFonts)).value(token);
	/* Now we check whether isBold=true and isItalic=true. If yes, we will set those */
	if (isBold && !(curFontUsed.style()).contains("Bold"))
	{
		setBold();
		isBold=false;
	}
	if (isItalic && !(curFontUsed.style()).contains("Italic"))
	{
		setItalics();
		isItalic=false;
	}
	if (define == 0)
	{
		flushText();
		currentCharStyle.setFont(curFontUsed);
		writer->setCharStyle(currentCharStyle);
		currentCharStyle = writer->getCurrentCharStyle();
	}
	if (define == 1)
		defCharStyle.setFont(curFontUsed);
	if (define == 2)
		defParagraphStyle.charStyle().setFont( curFontUsed );
}