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!

… 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?

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.

“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)

“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?

“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

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?

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




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.

it was a “Hail Mary pass”.
ostensibly, “font:LargeBoldSystemFont” could be a file specifier. :slightly_smiling_face:

“EnTerr” wrote:
it was a “Hail Mary pass”.
ostensibly, “font:LargeBoldSystemFont” could be a file specifier. :slightly_smiling_face:
Let’s hope that’s why they used the word ‘Currently’ in the docs.

@belltown

thanks for showing me how to set the size for a system Font.
I am a little embarrassed that I did not try that myself… :oops:

this code seemed a little weird, but obvioulsy setting the font of a Label to a string converts it to a Font Node

m.top.font = "font:LargeBoldSystemFont"
m.top.font.size = 20

“philotas” wrote:
this code seemed a little weird, but obvioulsy setting the font of a Label to a string converts it to a Font Node

m.top.font = "font:LargeBoldSystemFont"
m.top.font.size = 20

It is weird, isn’t it! :idea:
.font property is polymorphic, apparently - takes (and returns) font objects but if assigned string, converts it to a Font on the spot. And hence the next line works (“wait, what? how am i assigning number to a field in a string?!”)

Yes it is!
This could be at least documented…

“philotas” wrote:
Yes it is!
This could be at least documented…
Documentation is for wimps! :laughing:
i suspect the docu-mentalist has jumped Roku ship (either that or RSG drove them past the verge of nervous breakdown?), since have not updated a single page in over 3 months.
Drop a request/note in viewtopic.php?f=34&t=69731, maybe someone will be shoring up

Actually it does state in the documentation that you can set the font’s size property, if that’s what you were looking for:

In https://sdkdocs.roku.com/display/sdkdoc/Typography:

you can also set sizes explicitly using BrightScript:
m.mylargerlabel.font.size = m.mylargerlabel.font.size+5