Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. font icon as tts format
Qt 6.11 is out! See what's new in the release blog

font icon as tts format

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 686 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    seyedmm021
    wrote on last edited by
    #1

    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

    DiracsbracketD 1 Reply Last reply
    0
    • S seyedmm021

      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

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #2

      @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.

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved