FontLoader: Load Entire Family Font Files



  • How can i load 4 font files with the same font type name?
    I have trebuchet.ttf, trebucheti.ttf, trebuchetb.ttf and trebuchetbi.ttf and all of them have "Trebuchet MS" as their font type name.
    When i use FontLoader i initially test if the font has been loaded before so it doesn't end up failing:

    @
    FontLoader{
    id: trebuchet
    }

    Component.onCompleted:{
    var families = Qt.fontFamilies().toString();
    if (families.match(/Trebuchet MS/i)) {
    trebuchet.name = "Trebuchet MS";
    } else {
    trebuchet.source = "fonts/trebuchet.ttf";
    }
    }
    @

    The problem is that they all use "Trebuchet MS" as their font type name, and that will end up making all fontloaders pointing to the default Trebuchet MS.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.