mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
Print a warning when the specified font family does not exist
This commit is contained in:
@@ -4,9 +4,10 @@
|
|||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from kitty.fast_data_types import CTFace as Face, coretext_all_fonts
|
from kitty.fast_data_types import CTFace as Face, coretext_all_fonts
|
||||||
from kitty.utils import ceil_int, get_logical_dpi, wcwidth
|
from kitty.utils import ceil_int, get_logical_dpi, safe_print, wcwidth
|
||||||
|
|
||||||
main_font = {}
|
main_font = {}
|
||||||
symbol_map = {}
|
symbol_map = {}
|
||||||
@@ -43,7 +44,9 @@ def find_best_match(font_map, family, bold, italic):
|
|||||||
|
|
||||||
# Let CoreText choose the font if the family exists, otherwise
|
# Let CoreText choose the font if the family exists, otherwise
|
||||||
# fallback to Menlo
|
# fallback to Menlo
|
||||||
family = family if q in font_map['family_map'] else 'Menlo'
|
if q not in font_map['family_map']:
|
||||||
|
safe_print('The font {} was not found, falling back to Menlo', file=sys.stderr)
|
||||||
|
family = 'Menlo'
|
||||||
return {
|
return {
|
||||||
'monospace': True,
|
'monospace': True,
|
||||||
'bold': bold,
|
'bold': bold,
|
||||||
|
|||||||
Reference in New Issue
Block a user