Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
philotas
Level 7

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
EnTerr
Level 8

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 ("fontSmiley FrustratedmallestSystemFont", SmallestBoldSystemFont, ..., LargeBoldSystemFont) don't satisfy you?
0 Kudos
belltown
Level 7

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.
https://github.com/belltown/
0 Kudos
philotas
Level 7

Re: How to modify System Fonts in SceneGraph?

"EnTerr" wrote:
("fontSmiley FrustratedmallestSystemFont", 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
Level 7

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
Level 7

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
https://github.com/belltown/
0 Kudos
EnTerr
Level 8

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
Level 7

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.
https://github.com/belltown/
0 Kudos
EnTerr
Level 8

Re: How to modify System Fonts in SceneGraph?

it was a "Hail Mary pass".
ostensibly, "font:LargeBoldSystemFont" could be a file specifier. Smiley Happy
0 Kudos
belltown
Level 7

Re: How to modify System Fonts in SceneGraph?

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

Let's hope that's why they used the word 'Currently' in the docs.
https://github.com/belltown/
0 Kudos