Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.8.0
-
None
Description
The letter spacing is incorrect when using small point sizes (<1.5 pt)
In the attached image, all the letters are spacing in an weird manner, and the letter 'm' is completelly off.
Diff:
@@ -302,7 +302,7 @@ void XFormView::drawTextType(QPainter *painter) QPainterPath path; QFont f("times new roman,utopia"); f.setStyleStrategy(QFont::ForceOutline); - f.setPointSize(72); + f.setPointSize(1); f.setStyleHint(QFont::Times); path.addText(0, 0, f, m_text); @@ -803,7 +803,7 @@ XFormWidget::XFormWidget(QWidget *parent) QGroupBox *scaleGroup = new QGroupBox(mainGroup); scaleGroup->setTitle(tr("Scale")); QSlider *scaleSlider = new QSlider(Qt::Horizontal, scaleGroup); - scaleSlider->setRange(1, 4000); + scaleSlider->setRange(1, 40000); scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *shearGroup = new QGroupBox(mainGroup);
Steps to reproduce using the examples/widgets/painting/affine:
- Make the 2 line change presented in the diff (xform.cpp).
- Compile and run affine example
- Click on "Animate"
- Click on "Reset Transform"
- Change type to "Text"
- Scale until text is readable
Actually, this issue is present since 5.5. I've managed to workaround this by using:
void GraphicsEdgeItem::setFontPointSize(qreal fontPointSize) { m_font.setPointSizeF(fontPointSize); if(fontPointSize < 1) m_font.setLetterSpacing(QFont::PercentageSpacing, 45); else m_font.setLetterSpacing(QFont().letterSpacingType(), QFont().letterSpacing()); }
Using Windows 7