From 9f8163864341952dc38eccb060e9ecc8409bfaac Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 10 Nov 2018 21:22:38 -0500 Subject: [PATCH] Add a font property to the item --- README.md | 1 + item/init.lua | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 97b6266..5aca7c1 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,7 @@ Multiple items can have multiple sets of options. | margins | Read/Write table (left,right,top and bottom) | dynamic table | | infoshapes | See the infoshapes widget documentation | array of infoshapes| | overlay_draw | Draw a custom painter on top of the item | draw function | +| font | Set a custom font | font_string | ### Colors options diff --git a/item/init.lua b/item/init.lua index 8d0c72d..6767c71 100644 --- a/item/init.lua +++ b/item/init.lua @@ -196,6 +196,11 @@ local function new_item(data,args) item_style(item) end + function item:set_font(f) + local text_w = item._internal.text_w + text_w:set_font(f) + end + function item:set_text(text) local text_w = item._internal.text_w if not text_w then return end