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. Set Canvas Context2D font from local font

Set Canvas Context2D font from local font

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 470 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.
  • T Offline
    T Offline
    twall
    wrote on last edited by
    #1

    Hello, I have a set of fonts that are installed locally to my development machine. They are included within my qml.qrc file. My application is a QML app that will be deployed to an embedded device that doesn't have my specific TTF font intstalled. Within my application, I have a Canvas object with a 2D context, and I'd like to apply my font there. However, when I try to use

    context.font = "18px fontName";
    

    or

    context.font = "18px qrc:/fonts/fontName.TTF"
    

    Neither appear to work on the target machine.

    I can get the font to work on the target machine with Text and FontLoader. But how can I load the font into a Canvas context?

    1 Reply Last reply
    1

    • Login

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