aboutsummaryrefslogtreecommitdiff
path: root/helpers/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r--helpers/__init__.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py
index f1a968b..4827e6c 100644
--- a/helpers/__init__.py
+++ b/helpers/__init__.py
@@ -6,9 +6,43 @@ import math
6import sounddevice as sd 6import sounddevice as sd
7import logging 7import logging
8 8
9from . import sysfont
10
9class Config: 11class Config:
10 pass 12 pass
11 13
14def find_font(name, style=sysfont.STYLE_NONE):
15 if getattr(sys, 'frozen', False):
16 font = sys._MEIPASS + "/fonts/{}_{}.ttf".format(name, style)
17 else:
18 font = sysfont.get_font(name, style=style)
19 if font is not None:
20 font = font[4]
21 return font
22
23def register_fonts():
24 from kivy.core.text import LabelBase
25
26 ubuntu_regular = find_font("Ubuntu", style=sysfont.STYLE_NORMAL)
27 ubuntu_bold = find_font("Ubuntu", style=sysfont.STYLE_BOLD)
28 symbola = find_font("Symbola")
29
30 if ubuntu_regular is None:
31 error_print("Font Ubuntu regular could not be found, please install it.")
32 sys.exit()
33 if symbola is None:
34 error_print("Font Symbola could not be found, please install it.")
35 sys.exit()
36 if ubuntu_bold is None:
37 warn_print("Font Ubuntu Bold could not be found.")
38
39 LabelBase.register(name="Ubuntu",
40 fn_regular=ubuntu_regular,
41 fn_bold=ubuntu_bold)
42 LabelBase.register(name="Symbola",
43 fn_regular=symbola)
44
45
12def path(): 46def path():
13 if getattr(sys, 'frozen', False): 47 if getattr(sys, 'frozen', False):
14 return sys._MEIPASS + "/" 48 return sys._MEIPASS + "/"