Forum Discussion

joetesta's avatar
joetesta
Roku Guru
8 years ago

how to use focusedTextFont in XML?

I have a button and I'd like to use a custom font included in the pkg:/ folder.  How can it be done without having to set the font object via brightscript?
I tried creating a node called "focusedTextFont" but it doesn't like that.  So I tried setting a node called "Font" (that birightscript would then have to set as the focusedTextFont) and it doesn't like a <font> node as a child on the button, nor by itself. 
I supposed it will work if the field is set to a system font, but is there any example of how to make it work with a custom included font?
tyvmia

BRIGHTSCRIPT: ERROR: roSGNode: No such field RenderableNode::font

2 Replies

  • Did you ever crack this?
    I'm trying to create a button as well with focus management that affects its style and i'm hitting this barrier too.

    • RobMich's avatar
      RobMich
      Channel Surfer

      You can set the font by including a child font object in the XML.  You can set the “role” of the font object to the value of the font setting you want to use.  Here is an example of how to do it with a label object, but it should work for a button as well.  From the description, it sounds like you will need to set the role to “focusedTextFont” or “textFont”.

      <Label
      id="Text1"
      horizAlign="center"
      vertAlign="center"
      width="600"
      height="60" >

      <Font role="font" uri="pkg:/Fonts/YOURFONT.TTF" size="32" />

      </Label>