Text.sel
#!./Selene
Selene.UseDirectFB("--dfb:quiet,no-vt")
DirectFB.init( DirectFB.CooperativeConst('FULLSCREEN') )
srf = SelSurface.create { caps=SelSurface.CapabilityConst('PRIMARY') } w,h = srf:GetSize() srf:Clear(0,0,0,0)
font = SelFont.create("/usr/local/share/fonts/corpuscare_light.ttf", { height=30, width=25} )
fonth = font:GetHeight() srf:SetFont( font )
srf:SetColor( 0xff, 0xff, 0xff, 0xff) srf:DrawString("This is a test", 15,20)
srf:DrawString("The line bellow", 15,20+fonth)
srf:SetColor( 0x80, 0xff, 0x80, 0xff );
offset = font:StringWidth("The line bellow")
srf:DrawString("- After", 15 + offset,20+fonth)
srf:SetColor( 0xff, 0x80, 0x80, 0xff );
srf:DrawString("An other one on the right", w-15,20+fonth*2, SelSurface.TextLayoutConst("RIGHT") + SelSurface.TextLayoutConst("TOP"))
print "Hit 'enter' key to exit"
io.stdin:read'*l'
font:destroy()
srf:destroy()