mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-03-12 20:42:45 -07:00
* fix localization nullpointer exception * fix devicelib error line:61,remove e * support create docker from cpu dockerfile * support preview or not when train(resolve cannot connect to X server)
31 lines
750 B
Python
31 lines
750 B
Python
import sys
|
|
import locale
|
|
|
|
system_locale = locale.getdefaultlocale()[0]
|
|
# system_locale may be nil
|
|
system_language = system_locale[0:2] if system_locale is not None else "en"
|
|
|
|
windows_font_name_map = {
|
|
'en' : 'cour',
|
|
'ru' : 'cour',
|
|
'zn' : 'simsun_01'
|
|
}
|
|
|
|
darwin_font_name_map = {
|
|
'en' : 'cour',
|
|
'ru' : 'cour',
|
|
'zn' : 'Apple LiSung Light'
|
|
}
|
|
|
|
linux_font_name_map = {
|
|
'en' : 'cour',
|
|
'ru' : 'cour',
|
|
'zn' : 'cour'
|
|
}
|
|
|
|
def get_default_ttf_font_name():
|
|
platform = sys.platform
|
|
if platform == 'win32': return windows_font_name_map.get(system_language, 'cour')
|
|
elif platform == 'darwin': return darwin_font_name_map.get(system_language, 'cour')
|
|
else: return linux_font_name_map.get(system_language, 'cour')
|