File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -393,14 +393,22 @@ def _load_font(self, config):
393
393
name = "Roboto"
394
394
395
395
# Retrieve font files, if not already done
396
- files = os .listdir (self .cache )
397
- files = [file for file in files if file .endswith (".ttf" ) or file .endswith (".otf" )] or (
396
+ all_files = []
397
+ # Check for cached files - note these may be in subfolders
398
+ for currentpath , folders , files in os .walk (self .cache ):
399
+ for file in files :
400
+ all_files .append (os .path .join (currentpath , file ))
401
+
402
+ # If none found, fetch from Google and try again
403
+ if len (all_files ) == 0 :
398
404
self ._load_font_from_google (name )
399
- )
405
+ for currentpath , folders , files in os .walk (self .cache ):
406
+ for file in files :
407
+ all_files .append (os .path .join (currentpath , file ))
400
408
401
409
# Map available font weights to file paths
402
410
font = dict ()
403
- for file in files :
411
+ for file in all_files :
404
412
match = re .search (r"-(\w+)\.[ot]tf$" , file )
405
413
if match :
406
414
font [match .group (1 )] = os .path .join (self .cache , file )
You can’t perform that action at this time.
0 commit comments