1
1
/***************************************************************************
2
* Copyright (C) 2006 by Luigi Toscano <luigi.toscano@tiscali.it> *
2
* Copyright (C) 2006-2009 by Luigi Toscano <luigi.toscano@tiscali.it> *
4
4
* This program is free software; you can redistribute it and/or modify *
5
5
* it under the terms of the GNU General Public License as published by *
62
63
OKULAR_EXPORT_PLUGIN( DviGenerator, createAboutData() )
64
65
DviGenerator::DviGenerator( QObject *parent, const QVariantList &args ) : Okular::Generator( parent, args ),
65
m_docInfo( 0 ), m_docSynopsis( 0 ), m_dviRenderer( 0 )
66
m_fontExtracted( false ), m_docInfo( 0 ), m_docSynopsis( 0 ), m_dviRenderer( 0 )
67
68
setFeature( Threaded );
68
69
setFeature( TextExtraction );
70
setFeature( FontInfo );
69
71
setFeature( PrintPostscript );
70
72
if ( Okular::FilePrinter::ps2pdfAvailable() )
71
73
setFeature( PrintToFile );
81
m_dviRenderer = new dviRenderer();
83
m_dviRenderer = new dviRenderer(documentMetaData("TextHinting", QVariant()).toBool());
82
84
#ifdef DVI_OPEN_BUSYLOOP
83
85
static const ushort s_waitTime = 800; // milliseconds
84
86
static const int s_maxIterations = 10;
402
405
return m_docSynopsis;
408
Okular::FontInfo::List DviGenerator::fontsForPage( int page )
412
Okular::FontInfo::List list;
414
// the list of the fonts is extracted once
415
if ( m_fontExtracted )
418
if ( m_dviRenderer && m_dviRenderer->dviFile &&
419
m_dviRenderer->dviFile->font_pool )
421
QList<TeXFontDefinition*> fonts = m_dviRenderer->dviFile->font_pool->fontList;
423
foreach (const TeXFontDefinition* font, fonts)
427
int zoom = (int)(font->enlargement*100 + 0.5);
428
if ( font->getFullFontName().isEmpty() )
430
name = QString( "%1, %2%" )
431
.arg( font->fontname )
436
name = QString( "%1 (%2), %3%" )
437
.arg( font->fontname )
438
.arg( font->getFullFontName() )
443
QString fontFileName;
444
if (!(font->flags & TeXFontDefinition::FONT_VIRTUAL)) {
445
if ( font->font != 0 )
446
fontFileName = font->font->errorMessage;
448
fontFileName = i18n("Font file not found");
450
if ( fontFileName.isEmpty() )
451
fontFileName = font->filename;
454
of.setFile( fontFileName );
456
Okular::FontInfo::FontType ft;
457
switch ( font->getFontType() )
459
case TeXFontDefinition::TEX_PK:
460
ft = Okular::FontInfo::TeXPK;
462
case TeXFontDefinition::TEX_VIRTUAL:
463
ft = Okular::FontInfo::TeXVirtual;
465
case TeXFontDefinition::TEX_FONTMETRIC:
466
ft = Okular::FontInfo::TeXFontMetric;
468
case TeXFontDefinition::FREETYPE:
469
ft = Okular::FontInfo::TeXFreeTypeHandled;
474
// DVI has not the concept of "font embedding"
475
of.setEmbedType( Okular::FontInfo::NotEmbedded );
476
of.setCanBeExtracted( false );
481
m_fontExtracted = true;
405
488
void DviGenerator::loadPages( QVector< Okular::Page * > &pagesVector )
407
490
QSize pageRequiredSize;