Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Printing Problem with the Helvetica Font [Qt 5.5.1]
Phil_W last edited by Phil_W
We are seeing that rich text having the Helvetica font prints out GARBLED using Qt 5.5.1 on Windows 7 and Windows 8.1. We were not seeing this problem with Qt 4.8.5.
We are seeing this with the QTextEdit widget (using QTextEdit::print()) and with text features in a Qwt 6.1.3 plot.
See the following three images, demonstrating use of many fonts.
(1) View of rich text in a QTextEdit widget.
(2) Screenshot of printed PDF file. (Direct printing to a physical printer shows the same results).
(3) Qt font dialog showing that Helvetica is an available font. (Interestingly, "Helvetica Neue" is not).
It's not easy for us to just avoid Helvetica because many of our users' data files (from our program) specify the Helvetica font.
(1) Any idea of what's going on here?
(2) Is there a way to check for the (relevant-) validity of a font at run time? (I'm not seeing any such methods).
Thank you in advance.
IIRC, you can query QFontDatabase.
Can you test with a more recent version of Qt if this is still happening ?
[SGaist, thanks. Negatory on a newer version of Qt. Building Qt with WebEngine is not something we've been able to do. We tried a lot. We're just recovering from our port from Qt4, which took literally years].
This may be a red herring -- I don't want to detract from the general problem -- but I am seeing our Qt 5.5.1, a qtbase/lib/fonts directory with twenty-four (24) helvetica_*_.qpf (QPF) files. (And not a lot of references to other fonts; that directory has 82 files altogether). I did try copying that directory in what seemed to be the correct place, relative to our application executable -- they didn't seem to be picked up (or at least, it didn't make a difference). THE "README" file in that fonts directory says that "QPF is the portable, endian-independent format used by Qt/Embedded 2.x and 3.x." -- so that doesn't even seem relevant for our Qt 5.5.1 widget-based desktop application. Does anyone know if these QPF files really could be relevant for that? And, if so, what we need to do to have our application pick them up?
Just to be sure I understand you correctly, are you building Qt yourself ?
@SGaist ... yes, we are. It's true that I did struggle with, and didn't succeed in a successful build of Qt 5.6 with Web Engine. But I have to admit that most of that "literally years" I referred to was porting our humongous application. We were still depending on the Qt3 compatibility library for myriad legacy pieces. We are using Web Kit ... including its HTML DOM API, which is not available in Web Engine (as the HTML document doesn't even live in the application process), so that's going to be something. (Of course, Web Kit is gone in Qt 5.6 ... and I did struggle a bit trying to build that as a separate library, but didn't get through that either). (I'm a bit out of my element with that sort of thing). We're on Windows, Visual Studio 2010, with commercial Qt licenses. Maybe we don't need to be building Qt at all -- I'm not sure (memory model issues and such may be just fine with the binary distributions). I guess it's a future-security issue for us -- being able to build Qt from source.
If you would like to stay with QtWebkit, there's @Konstantin-Tokarev reboot that might interest you.
Note that you don't have to build all of Qt yourself to build one module.
Well this problem with garbled Helvetica in printed output (see images in prior post) is fixed if we DISABLE font embedding ... with this:
- void QPrinter::setFontEmbeddingEnabled(bool enable)
(1) Does that given any insight into the problem we are having? (This is with Qt 5.5.1).
(2) How reasonable is it to DISABLE font embedding? Will that cause any problems for our users?
Thanks in advance.