On 07/18/2015 08:02 PM, william.croc...@analog.com wrote: > >>>> >>>> I am having a text rendering problem. >>> >>>> From some googling, I think it's because the hinting values are >>> obtained when unscaled, and then used even when scaled. >>> >>> What you can do in your example is >>> >>> scene_font.setHintingPreference(QFont::PreferNoHinting); >>> >> >> Elvis: >> >> You are the mam. That fixed it. >> > > Just shoot me. > That fixed the problem on Linux, > but I still see the problem on Windows. > It's off to Google I go. >
It appears that one needs to use the DirectWrite text rendering system on Windows. So, I configured with -directwrite which causes some Qt source files to #include "dwrite.h", which is good, but the only dwrite.h I can find appears to be a C# binding (because it uses the interface keyword.) Has anyone successfully built Qt on Windows with -directwrite ? Thanks. Bill >> I forgot the most import rule of software engineering in the 21st century: >> >> "No matter how obscure the problem, you are not the first to encounter it. >> Others have come before you, solved the problem and those solutions are >> there for all to see if you Google the right subject." >> >> Bill >> >>>> 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@qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/interest >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> >> > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest