xsecurelock: don't use bold for date

This commit is contained in:
Vincent Bernat 2021-12-13 21:07:00 +01:00
parent 53c5ecdfb2
commit de2c9879bc

View file

@ -69,9 +69,6 @@ def on_overlay_draw(widget, cctx, ctx):
wwidth, wheight = widget.get_parent().get_size() wwidth, wheight = widget.get_parent().get_size()
if ctx.clock: if ctx.clock:
time, date = ctx.clock time, date = ctx.clock
cctx.select_font_face(
ctx.font_family, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD
)
def draw(what, outline): def draw(what, outline):
cctx.move_to(*text_position) cctx.move_to(*text_position)
@ -79,12 +76,18 @@ def on_overlay_draw(widget, cctx, ctx):
cctx.show_text(what) cctx.show_text(what)
# Time # Time
cctx.select_font_face(
ctx.font_family, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD
)
cctx.set_font_size(ctx.clock_font_size) cctx.set_font_size(ctx.clock_font_size)
_, _, twidth, theight, _, _ = cctx.text_extents(re.sub(r"\d", "8", time)) _, _, twidth, theight, _, _ = cctx.text_extents(re.sub(r"\d", "8", time))
text_position = wwidth // 2 - twidth // 2, wheight // 3 text_position = wwidth // 2 - twidth // 2, wheight // 3
draw(time, 2) draw(time, 2)
# Date # Date
cctx.select_font_face(
ctx.font_family, cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL
)
cctx.set_font_size(ctx.clock_font_size // 3) cctx.set_font_size(ctx.clock_font_size // 3)
_, _, twidth, theight, _, _ = cctx.text_extents(date) _, _, twidth, theight, _, _ = cctx.text_extents(date)
text_position = wwidth // 2 - twidth // 2, wheight // 3 + theight * 1.5 text_position = wwidth // 2 - twidth // 2, wheight // 3 + theight * 1.5