Improve compatibility with bleeding edge Linux distributions
This commit is contained in:
parent
08c1c8c7c3
commit
260a13c380
1 changed files with 23 additions and 4 deletions
|
@ -40,15 +40,34 @@ class ApplicationController:
|
|||
if not os.path.isdir(persistent_state_path) or len(os.listdir(persistent_state_path)) == 0:
|
||||
shutil.copytree(f'{version.get_installation_path()}/resources/initial-state', persistent_state_path)
|
||||
|
||||
if (not os.path.isdir(font_path) or len(os.listdir(font_path)) == 0) and os.path.isdir('/usr/share/fonts/truetype'):
|
||||
if (not os.path.isdir(font_path) or len(os.listdir(font_path)) == 0) and os.path.isdir('/usr/share/fonts'):
|
||||
|
||||
font_families = [file.name for file in Path('/usr/share/fonts/truetype').iterdir() if file.is_dir()]
|
||||
preferred_font_families = ['dejavu', 'droid', 'liberation', 'libreoffice', 'noto', 'ubuntu']
|
||||
if os.path.isdir('/usr/share/fonts/truetype'):
|
||||
truetype_fonts_path = '/usr/share/fonts/truetype'
|
||||
else:
|
||||
truetype_fonts_path = '/usr/share/fonts'
|
||||
|
||||
font_families = [file.name for file in Path(truetype_fonts_path).iterdir() if file.is_dir()]
|
||||
|
||||
preferred_font_families = [
|
||||
'adwaita-sans-fonts',
|
||||
'dejavu',
|
||||
'droid',
|
||||
'google-droid-sans-fonts',
|
||||
'google-noto-sans-cjk-vf-fonts',
|
||||
'google-noto-sans-mono-cjk-vf-fonts',
|
||||
'liberation',
|
||||
'liberation-sans-fonts',
|
||||
'libreoffice',
|
||||
'noto',
|
||||
'open-sans',
|
||||
'ubuntu'
|
||||
]
|
||||
|
||||
font_family_subset = ApplicationController.__select_random_subset(font_families, preferred_font_families, 12)
|
||||
|
||||
for font_family in font_family_subset:
|
||||
shutil.copytree(f'/usr/share/fonts/truetype/{font_family}', f'{font_path}/{font_family}')
|
||||
shutil.copytree(f'{truetype_fonts_path}/{font_family}', f'{font_path}/{font_family}')
|
||||
|
||||
display = ApplicationController.__find_unused_display()
|
||||
time_zone = profile.determine_timezone()
|
||||
|
|
Loading…
Reference in a new issue