[Interest] Rhvche: y[Intereyshehht] Tegaxt renderiyng problev5,6π6m.h

QtRep qt cyril.qt at gmail.com
Sat Jul 18 12:00:15 CEST 2015


CBGBbghgvvgggvevevgvvgggvh avhhhnhg bby hvvhugehvervvvv chu high
BvgggggvgggccggvgvgggggvggghhhghghvgghhvhgvgggvhBC hub ng he gyfyHyyGH
On Jul 18, 2015 1:14 AM, "Bill Crocker" <william.crocker at analog.com> wrote:

> Hello:
>
> I am having a text rendering problem.
>
> The following code creates a QLabel and QGraphicsTextItem.
> The QLabel text is 60 pt. The QGraphicsTextItem text size is 6 pt,
> but then the view is scaled up by 10x. So, in the end both
> pieces of text are the same size on the screen.
>
> For me the QLabel text looks good while the
> QGraphicsTextItem is very badly kerned (char spacing).
>
> Does anyone know what is wrong
> with the QGraphicsTextItem implementation?
>
> (For all I know the QLabel text would be badly kerned
>   at 6pt as well, but it is hard to see.)
>
> Qt 4.8.6, RHEL 5.10
>
> Thanks.
>
> Bill
>
> -------------------------
> int
> main( int argc, char **argv ) {
>      QApplication app(argc,argv);
>
>      int sz = 6, scale = 10;
>      QString text = QString("Impedance");
>
>      // Text size is 60.
>      // This text renders well.
>      QFont label_font = QFont("Arial",scale*sz,QFont::Bold);
>      QLabel *label = new QLabel(text);
>      label->setFont(label_font);
>
>      // Text size is 6, then the view is zoomed in x10.
>      // This text is not properly kerned.
>      QFont scene_font = QFont("Arial",sz,QFont::Bold);
>      QTextDocument *html = new QTextDocument;
>      html->setDefaultFont(scene_font);
>      html->setHtml(text);
>      QGraphicsTextItem *gi = new QGraphicsTextItem;
>      gi->setDocument(html);
>      QGraphicsScene *sp = new QGraphicsScene;
>      sp->addItem(gi);
>      QGraphicsView *view = new QGraphicsView;
>      view->setScene(sp);
>      view->scale(scale,scale);
>
>      QHBoxLayout *hbox = new QHBoxLayout;
>      hbox->addWidget(label);
>      hbox->addWidget(view);
>
>      QWidget *wp = new QWidget;
>      wp->setLayout(hbox);
>      wp->show();
>
>      app.exec();
> }
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150718/251343c6/attachment.html>


More information about the Interest mailing list