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: 
Littlelies
Visitor

Custom font for Rowlist label ?

Hi, I would like to change the font for a rowlist label (to display Arabic chars).
I tried using rowLabelFont, but didn't manage to make it work.
How can I achieve that?
0 Kudos
9 REPLIES 9
EnTerr
Roku Guru

Re: Custom font for Rowlist label ?

Ha - WTH is type "font", i wonder?!
I mean, TFM says that rowLabelFont attribute type "font" but there is no such RSG type! (RSG types are enumerated here)
The doco imprecision can be vexing.
0 Kudos
RokuKC
Roku Employee
Roku Employee

Re: Custom font for Rowlist label ?

"EnTerr" wrote:
Ha - WTH is type "font", i wonder?!


Possibly https://sdkdocs.roku.com/display/sdkdoc/Font will help.
0 Kudos
EnTerr
Roku Guru

Re: Custom font for Rowlist label ?

"RokuKC" wrote:
"EnTerr" wrote:
Ha - WTH is type "font", i wonder?!

Possibly https://sdkdocs.roku.com/display/sdkdoc/Font will help.

I am afraid not - can you elaborate how does one assign an XML element (which "Font" is) to an XML attribute (which "rowLabelFont" is)?
As a reminder, XML attributes cannot be structured. And to re-iterate, RSG attribute types do not list a "font" data type - so if not from XML, i have no clue how to do that from B/S...
0 Kudos
RokuKC
Roku Employee
Roku Employee

Re: Custom font for Rowlist label ?

"EnTerr" wrote:
I am afraid not - can you elaborate how does one assign an XML element (which "Font" is) to an XML attribute (which "rowLabelFont" is)?


Your leopard-tracking skills are getting rusty. :roll: 😉

Notice the "role" attribute in the Font node, mentioned in https://sdkdocs.roku.com/display/sdkdoc/Font .

See https://sdkdocs.roku.com/display/sdkdoc ... Components and search for "<Font>".

Also https://sdkdocs.roku.com/display/sdkdoc/Typography .
0 Kudos
EnTerr
Roku Guru

Re: Custom font for Rowlist label ?

"RokuKC" wrote:
Your leopard-tracking skills are getting rusty. :roll: 😉

"Yeah, a regular Rip van Winkle", apparently.
I can't believe i forgot about the "role" karnapidasana. Tsk-tsk - I am disappointed in you, me! 😉

So to recap, the font can be 

  • specified as a string to the attribute (for system fonts)

  • assigned as roSgNode to the attribute (only in B/S)

  • or "the yoga role way" (only in XML)
0 Kudos
lisakb140
Visitor

Re: Custom font for Rowlist label ?

I am struggling with this same issue---what did you end up doing to make this work??
0 Kudos
ionatan
Roku Guru

Re: Custom font for Rowlist label ?

Did someone found a solution to use a custom font with rowlist label?

Update: role="rowLabelFont" would do it.
0 Kudos
norcaljohnny
Roku Guru

Re: Custom font for Rowlist label ?

Here are the steps to use a custom font

1. create a folder named "fonts" in the root folder of your app (ie components, images, fonts. out, source)
2. place the font in the newly created "fonts" folder (ie fonts(folder) > yourFontFile.otf(file))
3. create some Brightscript code for a font node and label node. (in this case I am using Apples SanFrancisco font named sf.otf and placed it in my "fonts" folder)


      label = CreateObject("roSGNode", "Label")
      font  = CreateObject("roSGNode", "Font")
      font.uri = "pkg:/fonts/sf.otf"
      font.size = 20
      label.font = font


So, now whenever I use the label node the font used for it will be my custom sf.otf font with a font size of 20

<label id=title text="Just some title" />
0 Kudos
MM_Lasse
Reel Rookie

Re: Custom font for Rowlist label ?

You can declare a Font in a Label like this:

<Label>
        <Font
            id="IdYourFont"
            role="font"
            uri="pkg:/.../fonts/YourFont.ttf"
            size="40"
        />
</Label>

And use it in a RowList like this:

<RowList
           [...]
            rowLabelFont="dictionary:IdYourFont"
/>
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.