I'm drawing text to a roImageCanvas to use as a loading page for a video player. Here is all of the code used to draw on the canvas below:
Sub videoPaintCanvas()
m.Canvas.AllowUpdates(false)
list = []
if m.progress < 100 then
color = "#000000"
titleFont = m.fonts.GetDefaultFont(75, false, false)
padding = 5
rect = {
w: titleFont.GetOneLineWidth(m.content.Title, m.layout.w) + padding * 2
h: titleFont.GetOneLineHeight() + padding * 2
x: 0
y: 0
}
rect.x = Int(m.layout.w / 2) - Int(rect.w / 2)
rect.y = Int(m.layout.h / 2) - rect.h
list.Push({
Text: m.content.Title
TextAttrs: { Font: titleFont }
TargetRect: rect
})
else if m.paused AND NOT m.seeking then
color = "#90000000"
list.Push({
url: "pkg:/images/pause.png"
TargetRect: {
x: Int(m.layout.w / 2) - 64
y: Int(m.layout.h / 2) - 64
w: 128
h: 128
}
CompositionMode: "Source_Over"
})
else if m.seeking AND m.seekSpeed > 0 then
color = "#90000000"
list.Push({
url: "pkg:/images/fast-forward.png"
TargetRect: {
x: Int(m.layout.w / 2) - 64
y: Int(m.layout.h / 2) - 64
w: 128
h: 128
}
CompositionMode: "Source_Over"
})
else if m.seeking AND m.seekSpeed < 0 then
color = "#90000000"
list.Push({
url: "pkg:/images/rewind.png"
TargetRect: {
x: Int(m.layout.w / 2) - 64
y: Int(m.layout.h / 2) - 64
w: 128
h: 128
}
CompositionMode: "Source_Over"
})
else
color = "#00000000"
end if
m.canvas.SetLayer(0, { Color: color, CompositionMode: "Source" })
m.canvas.SetLayer(1, list)
if m.progress < 100 then
m.loadingBar.UpdateProgress(m.progress, 100)
else if m.progress = 100 then
m.canvas.ClearLayer(m.loadingBar.layer1)
m.canvas.ClearLayer(m.loadingBar.layer2)
end if
m.canvas.AllowUpdates(true)
End Sub
m.fonts is a roFontRegistry object
m.canvas is the roImageCanvas used
m.progress is used to show a loading bar for buffering. (always between 1 and 100)
The specific part of this function I'm looking at right now is inside the if statement
if m.progress < 100 then
...
else if ...
No matter what size I specify in the m.fonts.GetDefaultFont(75, false, false), when I run the app, the font is the same size every time. I'm certain it is somehow defaulting to the "Medium" font size.
Any help is greatly appreciated.