Canvas.fontstyle readwrite


Get or set the current Canvas font style, a table value with the following optional boolean keys :

  • bold : true for bold font style
  • italic : true for italic font style
  • underline : true for underlined font style
  • strikeout : true for strikeout font style

Example

--! luart-extensions import 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:print(canvas.font, 16, 70) await win:showasync()