本文整理汇总了C++中poppler::Document::fonts方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::fonts方法的具体用法?C++ Document::fonts怎么用?C++ Document::fonts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poppler::Document
的用法示例。
在下文中一共展示了Document::fonts方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkSecondDocumentQuery
void TestFontsData::checkSecondDocumentQuery()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/tests/type3.pdf");
QVERIFY( doc );
QList<Poppler::FontInfo> listOfFonts = doc->fonts();
QCOMPARE( listOfFonts.size(), 2 );
// check we get the very same result when calling fonts() again (#19405)
QList<Poppler::FontInfo> listOfFonts2 = doc->fonts();
QCOMPARE( listOfFonts, listOfFonts2 );
delete doc;
}
示例2: checkScanForFonts
void TestFontsData::checkScanForFonts()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/tests/fonts.pdf");
QVERIFY( doc );
QList<Poppler::FontInfo> listOfFonts = doc->fonts();
QCOMPARE( listOfFonts.size(), 3 );
// check we get the very same result when gatering fonts using scanForFonts
QList<Poppler::FontInfo> listOfFonts2;
for ( int i = 0; i < doc->numPages(); ++i )
{
doc->scanForFonts( 1, &listOfFonts2 );
}
QCOMPARE( listOfFonts, listOfFonts2 );
// check doing a second scanForFonts gives no result
QList<Poppler::FontInfo> listOfFonts3;
for ( int i = 0; i < doc->numPages(); ++i )
{
doc->scanForFonts( 1, &listOfFonts3 );
}
QVERIFY( listOfFonts3.isEmpty() );
delete doc;
}
示例3: checkNoFonts
void TestFontsData::checkNoFonts()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/tests/image.pdf");
QVERIFY( doc );
QList<Poppler::FontInfo> listOfFonts = doc->fonts();
QCOMPARE( listOfFonts.size(), 0 );
delete doc;
}
示例4: main
int main( int argc, char **argv )
{
QApplication a( argc, argv ); // QApplication required!
if ( argc != 3)
{
qWarning() << "usage: test-password-qt4 owner-password filename";
exit(1);
}
Poppler::Document *doc = Poppler::Document::load(argv[2], argv[1]);
if (!doc)
{
qWarning() << "doc not loaded";
exit(1);
}
// output some meta-data
int major = 0, minor = 0;
doc->getPdfVersion( &major, &minor );
qDebug() << " PDF Version: " << qPrintable(QString::fromLatin1("%1.%2").arg(major).arg(minor));
qDebug() << " Title: " << doc->info("Title");
qDebug() << " Subject: " << doc->info("Subject");
qDebug() << " Author: " << doc->info("Author");
qDebug() << " Key words: " << doc->info("Keywords");
qDebug() << " Creator: " << doc->info("Creator");
qDebug() << " Producer: " << doc->info("Producer");
qDebug() << " Date created: " << doc->date("CreationDate").toString();
qDebug() << " Date modified: " << doc->date("ModDate").toString();
qDebug() << "Number of pages: " << doc->numPages();
qDebug() << " Linearised: " << doc->isLinearized();
qDebug() << " Encrypted: " << doc->isEncrypted();
qDebug() << " OK to print: " << doc->okToPrint();
qDebug() << " OK to copy: " << doc->okToCopy();
qDebug() << " OK to change: " << doc->okToChange();
qDebug() << "OK to add notes: " << doc->okToAddNotes();
qDebug() << " Page mode: " << doc->pageMode();
QStringList fontNameList;
foreach( const Poppler::FontInfo &font, doc->fonts() )
fontNameList += font.name();
qDebug() << " Fonts: " << fontNameList.join( ", " );
Poppler::Page *page = doc->page(0);
qDebug() << " Page 1 size: " << page->pageSize().width()/72 << "inches x " << page->pageSize().height()/72 << "inches";
PDFDisplay test( doc ); // create picture display
test.setWindowTitle("Poppler-Qt4 Test");
test.show(); // show it
return a.exec(); // start event loop
}
示例5: QVERIFY
void TestFontsData::checkType1()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/tests/text.pdf");
QVERIFY( doc );
QList<Poppler::FontInfo> listOfFonts = doc->fonts();
QCOMPARE( listOfFonts.size(), 1 );
QCOMPARE( listOfFonts.at(0).name(), QString("Helvetica") );
QCOMPARE( listOfFonts.at(0).type(), Poppler::FontInfo::Type1 );
QCOMPARE( listOfFonts.at(0).typeName(), QString("Type 1") );
QCOMPARE( listOfFonts.at(0).isEmbedded(), false );
QCOMPARE( listOfFonts.at(0).isSubset(), false );
delete doc;
}
示例6: checkTrueType
void TestFontsData::checkTrueType()
{
Poppler::Document *doc;
doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
QVERIFY( doc );
QList<Poppler::FontInfo> listOfFonts = doc->fonts();
QCOMPARE( listOfFonts.size(), 2 );
QCOMPARE( listOfFonts.at(0).name(), QString("Arial-BoldMT") );
QCOMPARE( listOfFonts.at(0).type(), Poppler::FontInfo::TrueType );
QCOMPARE( listOfFonts.at(0).typeName(), QString("TrueType") );
QCOMPARE( listOfFonts.at(0).isEmbedded(), false );
QCOMPARE( listOfFonts.at(0).isSubset(), false );
QCOMPARE( listOfFonts.at(1).name(), QString("ArialMT") );
QCOMPARE( listOfFonts.at(1).type(), Poppler::FontInfo::TrueType );
QCOMPARE( listOfFonts.at(1).typeName(), QString("TrueType") );
QCOMPARE( listOfFonts.at(1).isEmbedded(), false );
QCOMPARE( listOfFonts.at(1).isSubset(), false );
delete doc;
}
示例7: main
int main( int argc, char **argv )
{
QCoreApplication a( argc, argv ); // QApplication required!
if (!( argc == 2 ))
{
qWarning() << "usage: poppler-fonts filename";
exit(1);
}
Poppler::Document *doc = Poppler::Document::load(argv[1]);
if (!doc)
{
qWarning() << "doc not loaded";
exit(1);
}
std::cout << "name type emb sub font file";
std::cout << std::endl;
std::cout << "------------------------------------ ------------ --- --- ---------";
std::cout << std::endl;
foreach( const Poppler::FontInfo &font, doc->fonts() ) {
if (font.name().isNull()) {
std::cout << qPrintable( QString("%1").arg(QString("[none]"), -37) );
} else {
std::cout << qPrintable( QString("%1").arg(font.name(), -37) );
}
switch( font.type() ) {
case Poppler::FontInfo::unknown:
std::cout << "unknown ";
break;
case Poppler::FontInfo::Type1:
std::cout << "Type 1 ";
break;
case Poppler::FontInfo::Type1C:
std::cout << "Type 1C ";
break;
case Poppler::FontInfo::Type3:
std::cout << "Type 3 ";
break;
case Poppler::FontInfo::TrueType:
std::cout << "TrueType ";
break;
case Poppler::FontInfo::CIDType0:
std::cout << "CID Type 0 ";
break;
case Poppler::FontInfo::CIDType0C:
std::cout << "CID Type 0C ";
break;
case Poppler::FontInfo::CIDTrueType:
std::cout << "CID TrueType ";
break;
case Poppler::FontInfo::Type1COT:
std::cout << "Type 1C (OT) ";
break;
case Poppler::FontInfo::TrueTypeOT:
std::cout << "TrueType (OT) ";
break;
case Poppler::FontInfo::CIDType0COT:
std::cout << "CID Type 0C (OT) ";
break;
case Poppler::FontInfo::CIDTrueTypeOT:
std::cout << "CID TrueType (OT) ";
break;
}
if ( font.isEmbedded() ) {
std::cout << "yes ";
} else {
std::cout << "no ";
}
if ( font.isSubset() ) {
std::cout << "yes ";
} else {
std::cout << "no ";
}
std::cout << qPrintable( QString("%1").arg(font.file()) );
std::cout << std::endl;
}
delete doc;
}