Fix font dialog with missing font family and pixel sizes
Two related errors: When a non-existent font was set on the font dialog, the GTK native font dialog would just pick a default one. Also, if the font size was specified with pixel size, we would request -1 as the point size from Pango. The fix for both is to resolve the font before applying it to the font dialog, and set the actually resolved family, as well as point size. Note that if the point size is explicitly set, then we pass this to the font dialog, since the one returned by QFontInfo will always be calculated based on the (rounded) pixel size, so it will usually not match the request. This fixes tst_qfontdialog::setFont(). [ChangeLog][GTK2][Dialogs] Fixed requesting a font from font dialog with a non-existent family name and/or pixel size. Task-number: QTBUG-51148 Change-Id: Id9c783407778546b0cf3f9c3ab19f124e76c878e Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>bb10
parent
544bbcbcda
commit
d8e65d5756
|
|
@ -517,8 +517,8 @@ void QGtk2FontDialogHelper::hide()
|
|||
static QString qt_fontToString(const QFont &font)
|
||||
{
|
||||
PangoFontDescription *desc = pango_font_description_new();
|
||||
pango_font_description_set_size(desc, font.pointSizeF() * PANGO_SCALE);
|
||||
pango_font_description_set_family(desc, font.family().toUtf8());
|
||||
pango_font_description_set_size(desc, (font.pointSizeF() > 0.0 ? font.pointSizeF() : QFontInfo(font).pointSizeF()) * PANGO_SCALE);
|
||||
pango_font_description_set_family(desc, QFontInfo(font).family().toUtf8());
|
||||
|
||||
int weight = font.weight();
|
||||
if (weight >= QFont::Black)
|
||||
|
|
|
|||
Loading…
Reference in New Issue