diff options
author | Brad Hards <bradh@frogmouth.net> | 2005-07-04 08:21:27 +0000 |
---|---|---|
committer | Brad Hards <bradh@frogmouth.net> | 2005-07-04 08:21:27 +0000 |
commit | 08cca4670f8ae65333beacda85834112e76489d1 (patch) | |
tree | 668bd416171437afb90a5ff05d81a676f578a677 /qt4/tests | |
parent | 52af89d8303b50c45d5e4584d19ec8b7d7ebcf9b (diff) |
Add in a simple demo/test application, similar to the pdffonts
application in xpdf.
Diffstat (limited to 'qt4/tests')
-rw-r--r-- | qt4/tests/Makefile.am | 9 | ||||
-rw-r--r-- | qt4/tests/poppler-fonts.cpp | 76 |
2 files changed, 84 insertions, 1 deletions
diff --git a/qt4/tests/Makefile.am b/qt4/tests/Makefile.am index bf3dd547..ff546782 100644 --- a/qt4/tests/Makefile.am +++ b/qt4/tests/Makefile.am @@ -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 diff --git a/qt4/tests/poppler-fonts.cpp b/qt4/tests/poppler-fonts.cpp new file mode 100644 index 00000000..42c50a66 --- /dev/null +++ b/qt4/tests/poppler-fonts.cpp @@ -0,0 +1,76 @@ +#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; + } +} |