D7949: Allow to print pdf doc directly into a QPrinter

Oliver Sander noreply at phabricator.kde.org
Thu Oct 12 20:28:00 UTC 2017


sander added a comment.


  Without having looked at the code, here is a hypothesis of how Kate can print to a pdf file and have the text remain selectable.  The Arthur font drawing code uses the QPainter::drawGlyphRun method to paint individual glyphs/letters.  That method only receives a position and a QGlyphRun object (which in turn contains a QRawFont and char codes).  In my limited understanding, this mechanism makes selectable text impossible, because the unicode information is gone.
  
  However, QPainter also has various drawText methods, which are given unicode text, and which use the current QFont set with the setFont method. Possibly, these methods make QPainter retain the letter information when painting onto a QPrinter representing a pdf file.  However, QFonts cannot represent fonts that are embedded in a pdf document---you need a QRawFont for that.  For kate this does not matter, for poppler it does.
  
  > Background: [...] and we plan to have some features implemented in the print dialog (for Qt/Okular).
  
  Can I learn more about this somewhere?

REVISION DETAIL
  https://phabricator.kde.org/D7949

To: sander, #okular
Cc: ltoscano, rkflx, michaelweghorn, ngraham, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20171012/d7c7276b/attachment.html>


More information about the Okular-devel mailing list