Commit 08cca467 authored by Brad Hards's avatar Brad Hards
Browse files

Add in a simple demo/test application, similar to the pdffonts

application in xpdf.
parent 52af89d8
......@@ -9,7 +9,8 @@ LDADDS = \
$(top_builddir)/qt4/src/libpoppler-qt4.la \
$(POPPLER_QT4_LIBS)
noinst_PROGRAMS = test-poppler-qt4 stress-poppler-qt4
noinst_PROGRAMS = test-poppler-qt4 stress-poppler-qt4 \
poppler-fonts
test_poppler_qt4_SOURCES = \
......@@ -18,6 +19,12 @@ test_poppler_qt4_SOURCES = \
test_poppler_qt4_LDADD = $(LDADDS)
poppler_fonts_SOURCES = \
poppler-fonts.cpp
poppler_fonts_LDADD = $(LDADDS)
stress_poppler_qt4_SOURCES = \
stress-poppler-qt4.cpp
......
#include <QtCore/QtCore>
#include <iostream>
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h>
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 uni";
std::cout << std::endl;
std::cout << "------------------------------------ ------------ --- --- ---";
std::cout << std::endl;
foreach( Poppler::FontInfo font, doc->fonts() ) {
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;
}
if ( font.isEmbedded() ) {
std::cout << "yes ";
} else {
std::cout << "no ";
}
if ( font.isSubset() ) {
std::cout << "yes ";
} else {
std::cout << "no ";
}
if ( font.requiresUnicodeConversion() ) {
std::cout << "yes ";
} else {
std::cout << "no ";
}
std::cout << std::endl;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment