Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.3.2
-
Linux
Description
With the following Web page:
<html> <style> @font-face { font-family: 'Ubuntu Mono'; font-style: normal; font-weight: 400; src: url(http://astefanutti.io/further-cdi/fonts/UbuntuMono-Regular.woff) format('woff'); } body { font-family: 'Ubuntu Mono', monospace; } </style> <body> <div> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </body> </html>
When printing the page to PDF with the following code:
#include <QApplication> #include "mywebview.h" int main(int argc,char** argv) { QApplication app(argc, argv); MyWebView view; view.load(QUrl(argv[1])); return app.exec(); }
#include <QApplication> #include <QPrinter> #if (QT_VERSION < 0x050000) #include <QWebView> #else #include <QtWebKitWidgets/QWebView> #endif class MyWebView:public QWebView { Q_OBJECT public: MyWebView() { m_printer.setPageSize(QPrinter::A4); m_printer.setOutputFormat(QPrinter::PdfFormat); m_printer.setOutputFileName("test.pdf"); connect(this,SIGNAL(loadFinished(bool)),this,SLOT(savetoPDF())); } ~MyWebView(){} private slots: void savetoPDF() { print(&m_printer); QApplication::exit(); } private: QPrinter m_printer; };
The generated PDF does not embed the Web font with Qt 5 - test-qt5.pdf, 177KB, Qt 5.3.2 - while it works as expected with Qt 4 - test-qt4.pdf, 6.2KB, Qt 4.8.6.
When the Web font is referenced locally and is present on the local file system, it gets correctly embedded in the generated PDF.