Details
-
Bug
-
Resolution: Moved
-
P3: Somewhat important
-
None
-
5.11.3
-
None
-
ubuntu16.04
Description
Qt在绘制一些点阵字体的时候。如果Qt的坐标系经过了矩阵变化,绘制点阵字体的规则就会变化。并不符合freetype的绘制规则。
Translated by Google:
When Qt draws some bitmap fonts. If the coordinate system of Qt has undergone a matrix change, the rules for drawing dot matrix fonts will change. It does not conform to the drawing rules of freetype.
下面代码片段 A
QPainter painter(this);
painter.setWindow(0, 0, 1440, 1440);
painter.setViewport(0, 0, 96, 96);
QString strText = QString::fromUtf8("永");
QFont font1;
font1.setFamily(QString::fromUtf8("simsun"));
font1.setPixelSize(210);
painter.setFont(font1);
painter.drawText(QPointF(300, 400), strText);
代码片段B
QPainter painter(this);
QString strText = QString::fromUtf8("永");
QFont font1;
font1.setFamily(QString::fromUtf8("simsun"));
font1.setPixelSize(14);
painter.setFont(font1);
painter.drawText(QPointF(300, 400), strText);
A这段代码的效果在Linux上会绘制出抗锯齿的效果,但是在Windows上会绘制出点阵字体的效果。B段代码与A段代码绘制的字体大小一致,但是A发生了抗锯齿,B还是显示点阵字体。发现Qt在从freetype获取字体时Ft_Set_Char_Size的时候将矩阵转化完之后的字体大小传递过去了。我觉得这种方式不太合理。至少要A段代码 WIndows,Linux的绘制效果保持一致。都变成点阵字体绘制。Freetype的规则在Linux下应该适应下,应该多大的显示字号是否该抗锯齿。
Translated by Google:
A The effect of this code will draw the effect of anti-aliasing on Linux, but it will draw the effect of dot matrix fonts on Windows. The font size drawn by the code in section B is the same as that in section A, but anti-aliasing occurs in A, and B still displays dot matrix fonts. It is found that Qt passes the font size after matrix conversion when Ft_Set_Char_Size gets the font from freetype. I don't think this approach is reasonable. At least part A of the code must have the same drawing effect on WIndows and Linux. All become dot-matrix fonts for drawing. The rules of Freetype should be adapted under Linux, and how large the font size should be displayed should be anti-aliased.