I am trying to draw text to the screen but for some reason it is not appearing, Here is a code snippet :
' RGBA converter
function HexToInteger3(hex_in)
bArr = createobject("roByteArray")
if len(hex_in) mod 2 > 0
'fix for fromHexString() malicious silent failure on odd length
hex_in = "0" + hex_in
end if
bArr.fromHexString(hex_in)
out = 0
for i = 0 to bArr.count()-1
out = 256 * out + bArr[i]
end for
return out
end function
' Define font
reg = CreateObject("roFontRegistry")
reg.Register("pkg:/fonts/SourceSansPro-Regular.ttf")
sansFont = reg.GetFont("Sans Pro", 42, false, false)
' Draw Menu
whiteColor = HexToInteger3("#F6F6F6")
screen = CreateObject("roScreen")
screen.DrawText("Item 1", 64, 155, whiteColor, sansFont)
screen.DrawText("Item 2", 64, 218 , whiteColor, sansFont)
screen.DrawText("Item 3", 64, 281, whiteColor, sansFont)
screen.DrawText("Item 4", 64, 344, whiteColor, sansFont)
screen.DrawText("Item 5", 64, 407, whiteColor, sansFont)
screen.finish()
I have used the function HexToInteger3 to fill rectangles and it works and the font is also been used in other applications.