本文整理汇总了C++中QRawFont::pixelSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QRawFont::pixelSize方法的具体用法?C++ QRawFont::pixelSize怎么用?C++ QRawFont::pixelSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRawFont
的用法示例。
在下文中一共展示了QRawFont::pixelSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyConstructor
void tst_QRawFont::copyConstructor()
{
QFETCH(QFont::HintingPreference, hintingPreference);
{
QString rawFontFamilyName;
qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
QRawFont outerRawFont;
{
QRawFont rawFont(QString::fromLatin1(SRCDIR "testfont.ttf"), 11, hintingPreference);
QVERIFY(rawFont.isValid());
rawFontFamilyName = rawFont.familyName();
rawFontPixelSize = rawFont.pixelSize();
rawFontAscent = rawFont.ascent();
rawFontDescent = rawFont.descent();
rawFontTableSize = rawFont.fontTable("glyf").size();
QVERIFY(rawFontTableSize > 0);
{
QRawFont otherRawFont(rawFont);
QVERIFY(otherRawFont.isValid());
QCOMPARE(otherRawFont.pixelSize(), rawFontPixelSize);
QCOMPARE(otherRawFont.familyName(), rawFontFamilyName);
QCOMPARE(otherRawFont.hintingPreference(), hintingPreference);
QCOMPARE(otherRawFont.ascent(), rawFontAscent);
QCOMPARE(otherRawFont.descent(), rawFontDescent);
QCOMPARE(otherRawFont.fontTable("glyf").size(), rawFontTableSize);
}
{
QRawFont otherRawFont = rawFont;
QVERIFY(otherRawFont.isValid());
QCOMPARE(otherRawFont.pixelSize(), rawFontPixelSize);
QCOMPARE(otherRawFont.familyName(), rawFontFamilyName);
QCOMPARE(otherRawFont.hintingPreference(), hintingPreference);
QCOMPARE(otherRawFont.ascent(), rawFontAscent);
QCOMPARE(otherRawFont.descent(), rawFontDescent);
QCOMPARE(otherRawFont.fontTable("glyf").size(), rawFontTableSize);
}
outerRawFont = rawFont;
}
QVERIFY(outerRawFont.isValid());
QCOMPARE(outerRawFont.pixelSize(), rawFontPixelSize);
QCOMPARE(outerRawFont.familyName(), rawFontFamilyName);
QCOMPARE(outerRawFont.hintingPreference(), hintingPreference);
QCOMPARE(outerRawFont.ascent(), rawFontAscent);
QCOMPARE(outerRawFont.descent(), rawFontDescent);
QCOMPARE(outerRawFont.fontTable("glyf").size(), rawFontTableSize);
}
}
示例2: 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));
}
示例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: invalidRawFont
void tst_QRawFont::invalidRawFont()
{
QRawFont font;
QVERIFY(!font.isValid());
QCOMPARE(font.pixelSize(), 0.0);
QVERIFY(font.familyName().isEmpty());
QCOMPARE(font.style(), QFont::StyleNormal);
QCOMPARE(font.weight(), -1);
QCOMPARE(font.ascent(), 0.0);
QCOMPARE(font.descent(), 0.0);
QVERIFY(font.glyphIndexesForString(QLatin1String("Test")).isEmpty());
}
示例5: rawFontSetPixelSize
void tst_QRawFont::rawFontSetPixelSize()
{
QFETCH(QFont::HintingPreference, hintingPreference);
QTextLayout layout("Foobar");
QFont font = layout.font();
font.setHintingPreference(hintingPreference);
font.setPixelSize(12);
layout.setFont(font);
layout.beginLayout();
layout.createLine();
layout.endLayout();
QGlyphRun glyphs = layout.glyphRuns().at(0);
QRawFont rawFont = glyphs.rawFont();
QCOMPARE(rawFont.pixelSize(), 12.0);
rawFont.setPixelSize(24);
QCOMPARE(rawFont.pixelSize(), 24.0);
}
示例6: 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));
}