Enable PDF antialiasing
Stefan Bund [Sat, 30 Oct 2010 22:01:00 +0000 (00:01 +0200)]
PDFWidget.cc
PDFWidget.hh

index 76c559d..a768e4f 100644 (file)
@@ -27,6 +27,7 @@ prefix_ pykit::PDFWidget::PDFWidget(QString const & document, QNetworkAccessMana
     : QLabel(parent), manager_ (manager), currentPage_ (0)
 {
     document_.reset(Poppler::Document::load(document));
+    documentSetup();
     showPage();
 }
 
@@ -44,10 +45,18 @@ prefix_ void pykit::PDFWidget::netLoadDocument()
         return;
     QByteArray data (reply->read(reply->size()));
     document_.reset(Poppler::Document::loadFromData(data));
+    documentSetup();
     showPage();
     reply->deleteLater();
 }
 
+prefix_ void pykit::PDFWidget::documentSetup()
+{
+    document_->setRenderHint(Poppler::Document::Antialiasing, true);
+    document_->setRenderHint(Poppler::Document::TextAntialiasing, true);
+    document_->setRenderHint(Poppler::Document::TextHinting, false);
+}
+
 prefix_ void pykit::PDFWidget::showPage()
 {
     if (! document_)
index a6212ff..bbb7e51 100644 (file)
@@ -37,6 +37,7 @@ namespace pykit {
         void netLoadDocument();
 
     private:
+        void documentSetup();
         void showPage();
 
         QNetworkAccessManager * manager_;