PDA

View Full Version : Qml font.weight not working?



ecspertiza
10th March 2017, 10:39
Font this is trouble of Qt, im use Qt 5.8.0

I need paint font "SF UI Display", in main.cpp im load font



void installFont() {

QDir dir(":/font/");
QStringList fontList;
fontList << dir.entryList();

for (int i = 0; i < fontList.count(); ++i) {
int res = QFontDatabase::addApplicationFont(":/font/" + fontList.at(i));

if (res == -1)
qDebug() << Q_FUNC_INFO << "can`t add " << fontList.at(i);
}
}


in qml



Text {
id: label1
anchors.left: parent.left
anchors.leftMargin: 100
anchors.top: parent.top
anchors.topMargin: 100

text: "SF UI Display Light"

font.family: "SF UI Display"
font.pixelSize: 28
font.weight: Font.Light
}


but i see some other font, screen to qml, photoshop ->

https://joxi.ru/4zANB0SBwVOoA9

what im doing wrong ?

anda_skoa
11th March 2017, 11:07
Have you checked if QFontDatabase knows your font after you've added it?

Cheers,
_

ecspertiza
13th March 2017, 17:28
Font there is in QFontDatabase

in QWidget hawe some result http://joxi.ru/wRmzQXS0V3pOrO?d=1

Font "Helvetica Neue" have some problem

ecspertiza
15th March 2017, 19:27
On android, all font look is good. I`m can`t undrstand how this work on window. Standart application paint font is good, Qt use native render and can`t paint font.

anda_skoa
16th March 2017, 12:33
So it happens with both render modes?
Qt and Native?

Cheers,
_