Font sizes have been moved in to config file

This commit is contained in:
Vitali Samurov 2020-01-31 02:23:06 +02:00
parent a3aeaae33b
commit 8359015dc6
4 changed files with 17 additions and 14 deletions

View File

@ -8,7 +8,6 @@ from __future__ import print_function
from inkycal_icalendar import fetch_events
from configuration import*
fontsize = 14
show_events = True
print_events = False
style = 'D MMM YY HH:mm'
@ -19,7 +18,7 @@ border_top = int(middle_section_height * 0.02)
border_left = int(middle_section_width * 0.02)
"""Choose font optimised for the agenda section"""
font = ImageFont.truetype(NotoSans+'Medium.ttf', fontsize)
font = ImageFont.truetype(NotoSans+'Medium.ttf', agenda_font_size)
line_height = int(font.getsize('hg')[1] * 1.2) + 1
line_width = int(middle_section_width - (border_left*2))

View File

@ -16,8 +16,7 @@ at_in_your_language = 'at'
event_icon = 'square' # dot #square
style = "DD MMM"
fontsize = 16
font = ImageFont.truetype(NotoSans+'.ttf', fontsize)
font = ImageFont.truetype(NotoSans+'.ttf', calendar_font_size)
space_between_lines = 0
if show_events == True:

View File

@ -9,14 +9,12 @@ import feedparser
from random import shuffle
from configuration import *
fontsize = 14
"""Add a border to increase readability"""
border_top = int(bottom_section_height * 0.05)
border_left = int(bottom_section_width * 0.02)
"""Choose font optimised for the weather section"""
font = ImageFont.truetype(NotoSans+'.ttf', fontsize)
font = ImageFont.truetype(NotoSans+'.ttf', rss_font_size)
space_between_lines = 1
line_height = font.getsize('hg')[1] + space_between_lines
line_width = bottom_section_width - (border_left*2)

View File

@ -60,17 +60,24 @@ NotoSansCJK = fontpath+'NotoSansCJK/NotoSansCJKsc-'
NotoSans = fontpath+'NotoSans/NotoSans-SemiCondensed'
weatherfont = fontpath+'WeatherFont/weathericons-regular-webfont.ttf'
"""Fonts sizes"""
agenda_font_size = 14
calendar_font_size = 16
rss_font_size = 14
locales_font_size = 18
weather_font_size = 12
"""Automatically select correct fonts to support set language"""
if language in ['ja','zh','zh_tw','ko']:
default = ImageFont.truetype(NotoSansCJK+'Regular.otf', 18)
semi = ImageFont.truetype(NotoSansCJK+'Medium.otf', 18)
bold = ImageFont.truetype(NotoSansCJK+'Bold.otf', 18)
default = ImageFont.truetype(NotoSansCJK+'Regular.otf', locales_font_size)
semi = ImageFont.truetype(NotoSansCJK+'Medium.otf', locales_font_size)
bold = ImageFont.truetype(NotoSansCJK+'Bold.otf', locales_font_size)
else:
default = ImageFont.truetype(NotoSans+'.ttf', 18)
semi = ImageFont.truetype(NotoSans+'Medium.ttf', 18)
bold = ImageFont.truetype(NotoSans+'SemiBold.ttf', 18)
default = ImageFont.truetype(NotoSans+'.ttf', locales_font_size)
semi = ImageFont.truetype(NotoSans+'Medium.ttf', locales_font_size)
bold = ImageFont.truetype(NotoSans+'SemiBold.ttf', locales_font_size)
w_font = ImageFont.truetype(weatherfont, 10)
w_font = ImageFont.truetype(weatherfont, weather_font_size)
"""Create image with given parameters"""
image = Image.new('RGB', (display_width, display_height), background_colour)