Qt fonts don't work right
-
Code:
QFont font("Arial",12);
QString txt = "Yazı";qDebug()<<"################";
QFontMetrics fm(font);
width = fm.width(txt);
qDebug()<<"Normal Width: "<<width;font.setBold(true);
QFontMetrics fm2(font);
width = fm2.width(txt);
qDebug()<<"Bold Width: "<<width;qDebug()<<"################";
Output:
################
Normal Width: 26
Bold Width: 25
################ -
@ollarch Please try with word or other programs, you will see word's width is increasing, Qt is decreasing width of words when you do bold style, you can see normal style width is 26 but bold style is 25, I am actually senior C# developer , I am working with Qt 2 years, if you try that in C# or Java (Netbeans or Eclipse), you will see that width is increasing. or you can try that with any text editor. It is bug and Qt team must fix this problem.
-
@mehmetkarlik said in Qt fonts don't work right:
It is bug and Qt team must fix this problem.
So did you file a bug report about this already? Please post the url here for reference.
-
Hi,
Have you tryied using a QPaintDevice in the QFontMetrics constructor? Also you could try QFontMetricsF if you get different result.
Congrats to be a senior C# developer. We are trying to help you but if you don't want our help don't ask the forum. As an experienced developer you can debug Qt fonts ans see how QFontMetrics does this calculus.
-
@Christian-Ehrlicher Ok, I created a bug report.
-
@mehmetkarlik Ok.