Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.4.1
-
None
Description
Put a TTF font in the Resources of the Qt app.
Load this font in the Qt app like this:
QFontDatabase::addApplicationFont(":/Resources/myfont.ttf");
Now use QPdfWriter to generate a PDF using painter.setFont(myfont) and painter.DrawText(...).
Result : the generated PDF file will be very large (probably because the font is not embedded in the PDF and this makes all text to be vectorized). Also the text won't be selectable in the pdf.
It's on Windows only (MacOS and Android are fine) with qt6.4.1 but it's there since sometime (maybe even in qt5).
This doesn't happen if the font is installed on the PC.
This doesn't happen if you load the font directly on the hard drive:
QFontDatabase::addApplicationFont("c:/myfont.ttf");
Workaround: copy the file from the Resources to the temp folder, and use QFontDatabase::addApplicationFont(...) with this copy.