Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Roku Guru

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
aspiring
2 REPLIES 2
jfrux
Newbie

Re: how to use focusedTextFont in XML?

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.

0 Kudos
RobMich
Channel Surfer

Re: how to use focusedTextFont in XML?

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>

Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.