[konsole] [Bug 378152] The SemiCondensed Fixed font isn't handled correctly by Konsole

Jiri Slaby bugzilla_noreply at kde.org
Wed Nov 10 09:34:20 GMT 2021


https://bugs.kde.org/show_bug.cgi?id=378152

--- Comment #4 from Jiri Slaby <jirislaby at gmail.com> ---
It's because QFont::fromString(const QString &descrip) doesn't OR the
QFont::resolve_mask with QFont::StyleNameResolved the same as
QFont::setStyleName(const QString &styleName) does. So this is an upstream (Qt)
bug. Reproducer:
================
$ cat main.cpp
#include <QApplication>
#include <QDebug>
#include <QLabel>
#include <QDialog>

static void setLabelFont(QLabel &label, const QFont &font)
{
        qDebug() << __func__ << font <<
                    "style" << font.style() << "stylename" << font.styleName()
                 << "resolve" << QString::number(font.resolve(), 16);
        label.setFont(font);
        label.setText(font.toString());
}

int main(int argc, char *argv[])
{
        QApplication a(argc, argv);
        QDialog w;
        QLabel label1(&w), label2(&w);

        QFont font1;
        font1.fromString("Misc Fixed,10,-1,5,57,0,0,0,0,0,SemiCondensed");
        auto font2 = font1;
#if 1
        font2.resolve(font2.resolve() |
QFont::ResolveProperties::StyleNameResolved);
#else
        font2.setStyleName("SemiCondensed");
#endif
        setLabelFont(label1, font1);
        setLabelFont(label2, font2);

        w.show();

        label2.move(0, label1.size().height() + 5);
        w.resize(label1.size().width(), label2.pos().y() +
label2.size().height());

        return a.exec();
}
================
$ cat Makefile 
COMPONENTS=Qt5Core Qt5Gui Qt5Widgets
CXXFLAGS=$(shell pkg-config --cflags $(COMPONENTS)) -Wall -Og -g
LDLIBS=$(shell pkg-config --libs $(COMPONENTS)) -flto

all: main
================

Both labels are with the same font, the latter sets the resolve_mask and is
shown correctly.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list