[poppler] poppler/qt4/tests: Makefile.am, 1.1, 1.2 poppler-fonts.cpp, NONE, 1.1

Brad Hards bradh at freedesktop.org
Mon Jul 4 01:21:29 PDT 2005


Update of /cvs/poppler/poppler/qt4/tests
In directory gabe:/tmp/cvs-serv10688

Modified Files:
	Makefile.am 
Added Files:
	poppler-fonts.cpp 
Log Message:
Add in a simple demo/test application, similar to the pdffonts
application in xpdf.


Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am	28 Jun 2005 10:00:09 -0000	1.1
+++ Makefile.am	4 Jul 2005 08:21:27 -0000	1.2
@@ -9,7 +9,8 @@
 	$(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_LDADD = $(LDADDS)
 
 
+poppler_fonts_SOURCES =			\
+       poppler-fonts.cpp
+
+poppler_fonts_LDADD = $(LDADDS)
+
+
 
 stress_poppler_qt4_SOURCES =			\
        stress-poppler-qt4.cpp

--- NEW FILE: poppler-fonts.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;
    }
}



More information about the poppler mailing list