Results 1 to 5 of 5

Thread: Qml font.weight not working?

  1. #1
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qml font.weight not working?

    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

    Qt Code:
    1. void installFont() {
    2.  
    3. QDir dir(":/font/");
    4. QStringList fontList;
    5. fontList << dir.entryList();
    6.  
    7. for (int i = 0; i < fontList.count(); ++i) {
    8. int res = QFontDatabase::addApplicationFont(":/font/" + fontList.at(i));
    9.  
    10. if (res == -1)
    11. qDebug() << Q_FUNC_INFO << "can`t add " << fontList.at(i);
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

    in qml

    Qt Code:
    1. Text {
    2. id: label1
    3. anchors.left: parent.left
    4. anchors.leftMargin: 100
    5. anchors.top: parent.top
    6. anchors.topMargin: 100
    7.  
    8. text: "SF UI Display Light"
    9.  
    10. font.family: "SF UI Display"
    11. font.pixelSize: 28
    12. font.weight: Font.Light
    13. }
    To copy to clipboard, switch view to plain text mode 

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

    https://joxi.ru/4zANB0SBwVOoA9

    what im doing wrong ?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qml font.weight not working?

    Have you checked if QFontDatabase knows your font after you've added it?

    Cheers,
    _

  3. #3
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qml font.weight not working?

    Font there is in QFontDatabase

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

    Font "Helvetica Neue" have some problem

  4. #4
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qml font.weight not working?

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qml font.weight not working?

    So it happens with both render modes?
    Qt and Native?

    Cheers,
    _

Similar Threads

  1. How to properly change font weight in model?
    By adutzu89 in forum Newbie
    Replies: 4
    Last Post: 19th March 2014, 16:01
  2. Font Height and width based on font size
    By Ghufran in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2010, 08:02
  3. Style sheets and font weight bug
    By Oleg in forum Qt Programming
    Replies: 8
    Last Post: 14th February 2010, 22:19
  4. font incorrectly show - font break.
    By sgh in forum Qt Programming
    Replies: 9
    Last Post: 30th May 2008, 02:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.