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: 
philotas
Roku Guru

How to modify System Fonts in SceneGraph?

Is it possible to make different version of the Build in SceneGraph Fonts, for example making a smaller, bigger or italic version of one font?

In BrightScript i could do something like this to get 10pt italic font, but in SceneGraph?


    reg = CreateObject("roFontRegistry")
    font = reg.GetDefaultFont(10, false, true)

 
I know, that I could create a Font node with my embedded TTF but I am asking for creating versions of the build in fonts.
thanks!
0 Kudos
14 REPLIES 14
EnTerr
Roku Guru

Re: How to modify System Fonts in SceneGraph?

<scratches head>... well, ordinarily i'd expect you should be able to assign to the font attribute a roFont, which is what you get from getDefaultFont(). But seems the RSG Maker - "bless the Maker and His water!" - thinks different.

Hm. The "Currently only font files included in the application can be specified." comment for the URI attribute is not encouraging. The choices the Maker giveth ("font:SmallestSystemFont", SmallestBoldSystemFont, ..., LargeBoldSystemFont) don't satisfy you?
0 Kudos
belltown
Roku Guru

Re: How to modify System Fonts in SceneGraph?

You can change the font size of any of the system fonts to any value you want, and the system fonts provide bold equivalents for each of the non-bolded fonts; however, I don't see any way to create an italic font from a system font.
0 Kudos
philotas
Roku Guru

Re: How to modify System Fonts in SceneGraph?

"EnTerr" wrote:
("font:SmallestSystemFont", SmallestBoldSystemFont, ..., LargeBoldSystemFont) don't satisfy you?

no, because I need italic (although it is not a nice way for formatting on a TV I admit)
0 Kudos
philotas
Roku Guru

Re: How to modify System Fonts in SceneGraph?

"belltown" wrote:
You can change the font size of any of the system fonts to any value you want,

How do I do that in SceneGraph for a Label Node?
I can set the Size of a Font Node, but afaik I cannot create a Font Node with a system font?
0 Kudos
belltown
Roku Guru

Re: How to modify System Fonts in SceneGraph?

"philotas" wrote:
"belltown" wrote:
You can change the font size of any of the system fonts to any value you want,

How do I do that in SceneGraph for a Label Node?
I can set the Size of a Font Node, but afaik I cannot create a Font Node with a system font?

Set the size property of the label's font property, e.g. in your component's init() function:


<Label
     id="labelNode"
     text="Ultimate Label"
     font="font:LargeBoldSystemFont" />



label = m.top.findNode("labelNode")
label.font.size = 42
0 Kudos
EnTerr
Roku Guru

Re: How to modify System Fonts in SceneGraph?

Any chance it can be done via karnapidasana?

<label text="Ultimate Label">
 <font role="font" uri="font:LargeBoldSystemFont" size="24"/>
</label>
i.e. does "font:" qualify as URI protocol?
0 Kudos
belltown
Roku Guru

Re: How to modify System Fonts in SceneGraph?

"EnTerr" wrote:
Any chance it can be done via karnapidasana?

<label text="Ultimate Label">
 <font role="font" uri="font:LargeBoldSystemFont" size="24"/>
</label>

 i.e. does "font:" qualify as URI protocol?

I just tried it and it didn't work. It does say in the docs under uri: Specifies a TrueType or OpenType font file. Currently only font files included in the application can be specified.
0 Kudos
EnTerr
Roku Guru

Re: How to modify System Fonts in SceneGraph?

it was a "Hail Mary pass".
ostensibly, "font:LargeBoldSystemFont" could be a file specifier. 🙂
0 Kudos
belltown
Roku Guru

Re: How to modify System Fonts in SceneGraph?

"EnTerr" wrote:
it was a "Hail Mary pass".
ostensibly, "font:LargeBoldSystemFont" could be a file specifier. 🙂

Let's hope that's why they used the word 'Currently' in the docs.
0 Kudos