本文整理汇总了C++中QFontDatabase::removeApplicationFont方法的典型用法代码示例。如果您正苦于以下问题:C++ QFontDatabase::removeApplicationFont方法的具体用法?C++ QFontDatabase::removeApplicationFont怎么用?C++ QFontDatabase::removeApplicationFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFontDatabase
的用法示例。
在下文中一共展示了QFontDatabase::removeApplicationFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: textLayout
void tst_QRawFont::textLayout()
{
QFontDatabase fontDatabase;
int id = fontDatabase.addApplicationFont(SRCDIR "testfont.ttf");
QVERIFY(id >= 0);
QString familyName = QString::fromLatin1("QtBidiTestFont");
QFont font(familyName);
font.setPixelSize(18.0);
QCOMPARE(QFontInfo(font).family(), familyName);
QTextLayout layout(QLatin1String("Foobar"));
layout.setFont(font);
layout.beginLayout();
layout.createLine();
layout.endLayout();
QList<QGlyphRun> glyphRuns = layout.glyphRuns();
QCOMPARE(glyphRuns.size(), 1);
QGlyphRun glyphs = glyphRuns.at(0);
QRawFont rawFont = glyphs.rawFont();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
QCOMPARE(rawFont.pixelSize(), 18.0);
QVector<quint32> expectedGlyphIndices;
expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86;
QCOMPARE(glyphs.glyphIndexes(), expectedGlyphIndices);
QVERIFY(fontDatabase.removeApplicationFont(id));
}
示例2:
Theme::~Theme()
{
QFontDatabase db;
Q_FOREACH(int id, d->addedFonts) {
db.removeApplicationFont(id);
}
delete d;
}
示例3: unsupportedWritingSystem
void tst_QRawFont::unsupportedWritingSystem()
{
QFETCH(QFont::HintingPreference, hintingPreference);
QFontDatabase fontDatabase;
int id = fontDatabase.addApplicationFont(QLatin1String(SRCDIR "testfont.ttf"));
QFont font("QtBidiTestFont");
font.setHintingPreference(hintingPreference);
font.setPixelSize(12.0);
QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(rawFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(rawFont.pixelSize(), 12.0);
QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);
QTextLayout layout;
layout.setFont(font);
layout.setText(arabicText);
layout.beginLayout();
layout.createLine();
layout.endLayout();
QList<QGlyphRun> glyphRuns = layout.glyphRuns();
QCOMPARE(glyphRuns.size(), 1);
QGlyphRun glyphs = glyphRuns.at(0);
QRawFont layoutFont = glyphs.rawFont();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(layoutFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic);
QCOMPARE(rawFont.familyName(), layoutFont.familyName());
QCOMPARE(rawFont.pixelSize(), 12.0);
fontDatabase.removeApplicationFont(id);
}
示例4: fromFont
void tst_QRawFont::fromFont()
{
QFETCH(QString, fileName);
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(QString, familyName);
QFETCH(QFontDatabase::WritingSystem, writingSystem);
QFontDatabase fontDatabase;
int id = fontDatabase.addApplicationFont(fileName);
QVERIFY(id >= 0);
QFont font(familyName);
font.setHintingPreference(hintingPreference);
font.setPixelSize(26.0);
QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
QCOMPARE(rawFont.pixelSize(), 26.0);
QVERIFY(fontDatabase.removeApplicationFont(id));
}