本文整理汇总了C++中QRawFont::styleName方法的典型用法代码示例。如果您正苦于以下问题:C++ QRawFont::styleName方法的具体用法?C++ QRawFont::styleName怎么用?C++ QRawFont::styleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRawFont
的用法示例。
在下文中一共展示了QRawFont::styleName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: multipleRawFontsFromData
void tst_QRawFont::multipleRawFontsFromData()
{
QFile file(QString::fromLatin1(SRCDIR "testfont.ttf"));
QRawFont testFont;
if (file.open(QIODevice::ReadOnly)) {
testFont.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting);
file.close();
}
file.setFileName(QLatin1String(SRCDIR "testfont_bold_italic.ttf"));
QRawFont testFontBoldItalic;
if (file.open(QIODevice::ReadOnly))
testFontBoldItalic.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting);
QVERIFY(testFont.familyName() != (testFontBoldItalic.familyName())
|| testFont.styleName() != (testFontBoldItalic.styleName()));
}
示例2: fontKey
QString QSGDistanceFieldGlyphCacheManager::fontKey(const QRawFont &font)
{
QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine;
if (!fe->faceId().filename.isEmpty()) {
QByteArray keyName = fe->faceId().filename;
if (font.style() != QFont::StyleNormal)
keyName += QByteArray(" I");
if (font.weight() != QFont::Normal)
keyName += ' ' + QByteArray::number(font.weight());
keyName += QByteArray(" DF");
return QString::fromUtf8(keyName);
} else {
return QString::fromLatin1("%1_%2_%3_%4")
.arg(font.familyName())
.arg(font.styleName())
.arg(font.weight())
.arg(font.style());
}
}
示例3: QPointF
QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
QQuickText::TextStyle style, const QColor &styleColor,
QSGNode *parentNode)
{
QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
QRawFont font = glyphs.rawFont();
bool preferNativeGlyphNode = m_useNativeRenderer;
if (!preferNativeGlyphNode) {
QRawFontPrivate *fontPriv = QRawFontPrivate::get(font);
if (fontPriv->fontEngine->hasUnreliableGlyphOutline())
preferNativeGlyphNode = true;
else
preferNativeGlyphNode = !QFontDatabase().isSmoothlyScalable(font.familyName(), font.styleName());
}
QSGGlyphNode *node = sg->sceneGraphContext()->createGlyphNode(sg, preferNativeGlyphNode);
node->setOwnerElement(m_ownerElement);
node->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
node->setStyle(style);
node->setStyleColor(styleColor);
node->setColor(color);
node->update();
/* We flag the geometry as static, but we never call markVertexDataDirty
or markIndexDataDirty on them. This is because all text nodes are
discarded when a change occurs. If we start appending/removing from
existing geometry, then we also need to start marking the geometry as
dirty.
*/
node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern);
node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern);
if (parentNode == 0)
parentNode = this;
parentNode->appendChildNode(node);
return node;
}