March 2, 2012

wesulaner wesulaner
Lab Rat
3 posts

Different font rendering between paint devices (QPicture, QPrinter)

 

How can I prompt QPainter to draw text on QPicture in the same way it do on a QPrinter device?

Output in PDF when I draw first in a QPicture an play() then to a painter with QPrinter Device:

  1.  
  2. m_painter->begin(m_picture);
  3. m_painter->setBrush(Qt::black);
  4. m_painter->setPen(Qt::black);
  5. m_painter->setFont(QFont("Arial", 9));
  6. m_painter->drawText(0,0, "In Alaska reichen die ältesten gesicherten menschlichen");
  7. m_painter->end();
  8.  
  9. m_painter->begin(m_printer);
  10. m_picture->play(m_painter);
  11. m_painter->end();

And this is the Output when I draw directily to a QPainter with a QPrinter:

  1. m_painter->begin(m_printer);
  2. m_painter->setBrush(Qt::black);
  3. m_painter->setPen(Qt::black);
  4. m_painter->setFont(QFont("Arial", 9));
  5. m_painter->drawText(0,0, "In Alaska reichen die ältesten gesicherten menschlichen");
  6. m_painter->end();

I’ll need paint first on Picture for a couple reasons.

Thank you in advance!
wesu

0 replies

 
  ‹‹ Opengl with QGraphicsItem and QGraphicsScene?      [SOLVED] Stylesheets: Giving a different color to the checkbox indicator than the text ››

You must log in to post a reply. Not a member yet? Register here!