I've been having a lot of problems trying to get text to fit with roImageCanvas.
I coded this up for roImageCanvas not roScreen, which is what
cheungj asked about.
It appears the Default font on HD is "Large" but not on SD displays. I even tried "Huge" but it still didn't fill the rectangle.
"GetOneLineWidth" looks close for HD BUT no where near on SD displays.
reg = CreateObject("roFontRegistry")
scr = CreateObject("roImageCanvas")
port = CreateObject( "roMessagePort" )
scr.SetMessagePort( port )
scr.SetLayer( 0, { color: "#FF808080" } )
scr.Show()
s = "Hello foo foo enjoy"
font = reg.GetDefaultFont()
w = font.GetOneLineWidth( s, 10000 )
h = font.GetOneLineHeight()
size = "Large"
txt = "w = "+w.ToStr()+" h = "+h.ToStr()+" "+size
items = CreateObject( "roArray", 100, 1 )
items.Push( { color: "#FFFFFFFF", TargetRect:{x:100,y:100,w:w,h:h}} )
items.Push( { Text:s,
TextAttrs:{ Color:"#FFFF0000", Font:size, HAlign:"Left", VAlign:"Middle" },
TargetRect:{ x:100,y:100,w:w,h:h }} )
items.Push( { Text:txt,
TextAttrs:{ Color:"#FF000000", Font:"Large", HAlign:"Left", VAlign:"Middle" },
TargetRect:{ x:100,y:50,w:600,h:60 }} )
scr.SetLayer( 1, items )
Results SDResults HD