Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

font icon as tts format



  • Hello
    I'm to basic at Qml but I have a question
    I download an icon from icommon as ttf format
    but how i have to use this icon???```
    you think that the code which I get from icomoon is <<e903>>

    foantLoader{
    source:""
    id:fontload}
    rectangle{
    width:80
    height:80
    text{
    font.familt:fontload.name
    text:"\e903"}
    

    thanks alot



  • @seyedmm021

    You can do it as follows:

        FontLoader { id: localFont; source: "icomoon.ttf" }
    
        Text {
            text: String.fromCharCode(parseInt('e900', 16))
            color: "lightsteelblue"
            width: parent.width
            wrapMode: Text.WordWrap
            font { family: localFont.name; pixelSize: 20 }
        }
    

    Where e900 is the code for the "home" icon.

    But are you sure you want to use ttf for your icons? Do they really need to display as text? If you only want icons, then you could also use the .svg format from icomoon, and use it as source of a regular Image.


Log in to reply