diff --git a/projector.py b/projector.py index b62cd35..024a374 100755 --- a/projector.py +++ b/projector.py @@ -92,7 +92,19 @@ class SongProjector: # Povratek na varne privzete self.settings = DEFAULT_SETTINGS.copy() - self.line_height = int(int(self.settings["font_size"]) * 1.5) + # -------------------------------------------------- + # Pisava (Font) + # -------------------------------------------------- + font_weight = "bold" if self.settings.get("font_bold", False) else "normal" + self.custom_font = font.Font( + family=self.settings["font_name"], + size=int(self.settings["font_size"]), + weight=font_weight + ) + + # Izračunamo dejansko višino vrstice glede na pisavo + # metrics("linespace") vrne priporočen razmik med vrsticami v pikslih + self.line_height = self.custom_font.metrics("linespace") # -------------------------------------------------- # Okno @@ -128,13 +140,6 @@ class SongProjector: self.right_frame = tk.Frame(root, bg="black", width=black_side_width, height=screen_height) self.right_frame.pack(side="right", fill="y") - font_weight = "bold" if self.settings.get("font_bold", False) else "normal" - self.custom_font = font.Font( - family=self.settings["font_name"], - size=int(self.settings["font_size"]), - weight=font_weight - ) - self.display_text = tk.Label( self.color_frame, text="", @@ -327,7 +332,8 @@ class SongProjector: if result: lyrics = result[0] - max_height = self.screen_height - (self.line_height * 2) + # Pustimo 10% varnostnega roba zgoraj in spodaj + prostor za song_info + max_height = self.screen_height * 0.85 # 1. Razdelimo na kitice (stanzas) # Kitice so ločene z eno ali več praznimi vrsticami