"eockh" wrote:
In the following call http://sdkdocs.roku.com/display/RokuSDK ... leanitalic
String Get(String Family, integer size, integer weight, Boolean italic)
If I call it with Get("Default", 36, 50, false) I get a 36 point regular weight font. The 3rd parameter is defined in the font. 50 is regular but what is bold?
Unless I'm completely misunderstanding what you're trying to do, it's not entirely clear to me why you chose to ignore my suggestions, and not just try this yourself, as it would have gotten you an answer infinitely quicker than waiting for an official answer from Roku, but... I spent 10 minutes and put this together for you:
Sub Main()
fontRegistry = CreateObject("roFontRegistry")
canvas = CreateObject("roImageCanvas")
canvas.SetMessagePort(CreateObject("roMessagePort"))
canvas.SetLayer(0, { Color: "#000000" })
layerIndex = 1
xStep = 160
yStep = 30
fontSize = 22
weight = 0
weightDelta = 1
For y = 0 To 720 - yStep Step yStep
For x = 0 To 1280 - xStep Step xStep
layer = {
Text: "Weight: " + weight.ToStr()
TextAttrs: {
Font: fontRegistry.Get("Default", fontSize, weight, False)
Color: "#FFFFFF"
HAlign: "Left"
}
TargetRect: {
x: x
y: y
w: xStep
h: yStep
}
}
canvas.SetLayer(layerIndex, layer)
layerIndex = layerIndex + 1
weight = weight + weightDelta
?x,y,layer.TextAttrs.Font
Next
Next
canvas.Show()
Wait(0, canvas.GetMessagePort())
End Sub
This will draw 192 different text strings to the screen, each with an increasing weight value. You can modify how much it increases by changing the "weightDelta" variable.
What you'll find is, specifying a different value for weight in the Get() method doesn't appear to have any effect on the actual weight of the text. You may also notice that the debug output shows that the result of fontRegistry.Get() is the same string every time, regardless of what you pass in for the weight.
Default,22,-1,5,2,0,0,0,0,0
Now, having seen the output of Get(), I decided to play with the numbers a little, and discovered that the fourth number (2) seems to control the weight of the font, so swapping the Get() line in the code above with a programmatically generated string, instead, I got this, which resulted in a font weight increase at the value of
63. If that doesn't give you sufficient information, then I'd suggest playing with the numbers further (particularly the zeros) to see if they have any more effect on the weight.
Sub Main()
fontRegistry = CreateObject("roFontRegistry")
canvas = CreateObject("roImageCanvas")
canvas.SetMessagePort(CreateObject("roMessagePort"))
canvas.SetLayer(0, { Color: "#000000" })
layerIndex = 1
xStep = 160
yStep = 30
fontSize = 22
weight = 0
weightDelta = 1
For y = 0 To 720 - yStep Step yStep
For x = 0 To 1280 - xStep Step xStep
layer = {
Text: "Weight: " + weight.ToStr()
TextAttrs: {
Font: "Default," + fontSize.ToStr() + ",-1,5," + weight.ToStr() + ",0,0,0,0,0"
Color: "#FFFFFF"
HAlign: "Left"
}
TargetRect: {
x: x
y: y
w: xStep
h: yStep
}
}
canvas.SetLayer(layerIndex, layer)
layerIndex = layerIndex + 1
weight = weight + weightDelta
?x,y,layer.TextAttrs.Font
Next
Next
canvas.Show()
Wait(0, canvas.GetMessagePort())
End Sub
So, it doesn't look like any value you pass to Get() is going to yield a bold font, but you can get bold if you build the font string yourself.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)