Canvas.fontstyle readwrite property


Get or set the current Canvas font style, a string value, which may be one of the following values :

  • "normal" : The characters in a normal, or roman, font are upright.
  • "italic" : The characters in an italic font are truly slanted and appear as they were designed.
  • "oblique" : The characters in an oblique font are artificially slanted.

Example

local ui = require "ui" require "canvas" -- create a fixed Window local win = ui.Window("Canvas:fontstyle() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) -- align the Canvas in all of its parent area canvas.font = "Times New Roman" canvas.fontsize = 37.5 canvas.fontstyle = "italic" -- don't use onPaint() event, draw only once canvas:begin() canvas:print(canvas.font, 16, 70) canvas:flip() -- shows the Window win:show() ui.run(win):wait()