justify day date font in odds ticker manager

This commit is contained in:
Chuck
2025-07-23 13:53:30 -05:00
parent 58bfdc04a0
commit 6c02b9dc4a
2 changed files with 15 additions and 6 deletions

View File

@@ -70,7 +70,7 @@
"ncaam_basketball_recent": 30, "ncaam_basketball_recent": 30,
"ncaam_basketball_upcoming": 30, "ncaam_basketball_upcoming": 30,
"music": 30, "music": 30,
"of_the_day": 60 "of_the_day": 40
}, },
"use_short_date_format": true "use_short_date_format": true
}, },
@@ -332,7 +332,7 @@
}, },
"of_the_day": { "of_the_day": {
"enabled": true, "enabled": true,
"display_rotate_interval": 30, "display_rotate_interval": 20,
"update_interval": 3600, "update_interval": 3600,
"subtitle_rotate_interval": 10, "subtitle_rotate_interval": 10,
"category_order": ["word_of_the_day", "slovenian_word_of_the_day"], "category_order": ["word_of_the_day", "slovenian_word_of_the_day"],

View File

@@ -762,7 +762,7 @@ class OddsTickerManager:
draw.text((current_x, odds_y_home), home_odds_text, font=odds_font, fill=odds_color) draw.text((current_x, odds_y_home), home_odds_text, font=odds_font, fill=odds_color)
current_x += odds_width + h_padding current_x += odds_width + h_padding
# Datetime (stacked, 3 rows) # Datetime (stacked, 3 rows) - Center justified
datetime_font_height = datetime_font.size if hasattr(datetime_font, 'size') else 6 datetime_font_height = datetime_font.size if hasattr(datetime_font, 'size') else 6
# Calculate available height for the three text lines # Calculate available height for the three text lines
@@ -775,9 +775,18 @@ class OddsTickerManager:
date_y = day_y + datetime_font_height + 2 date_y = day_y + datetime_font_height + 2
time_y = date_y + datetime_font_height + 2 time_y = date_y + datetime_font_height + 2
draw.text((current_x, day_y), day_text, font=datetime_font, fill=(255, 255, 255)) # Center justify each line of text within the datetime column
draw.text((current_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255)) day_text_width = int(temp_draw.textlength(day_text, font=datetime_font))
draw.text((current_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255)) date_text_width = int(temp_draw.textlength(date_text, font=datetime_font))
time_text_width = int(temp_draw.textlength(time_text, font=datetime_font))
day_x = current_x + (datetime_col_width - day_text_width) // 2
date_x = current_x + (datetime_col_width - date_text_width) // 2
time_x = current_x + (datetime_col_width - time_text_width) // 2
draw.text((day_x, day_y), day_text, font=datetime_font, fill=(255, 255, 255))
draw.text((date_x, date_y), date_text, font=datetime_font, fill=(255, 255, 255))
draw.text((time_x, time_y), time_text, font=datetime_font, fill=(255, 255, 255))
current_x += datetime_col_width + h_padding # Add padding after datetime current_x += datetime_col_width + h_padding # Add padding after datetime
if broadcast_logo: if broadcast_logo: