@@ -113,6 +113,12 @@ def check_font_info(font_info: dict[str, Any]) -> bool:
113113 logging .debug (f"{ family } : No file list" )
114114 return False
115115
116+ file_name = get_font_default (font_info ["defaults" ])
117+ file_info = font_info ["files" ].get (file_name , {})
118+ if "flourl" not in file_info and "url" not in file_info :
119+ logging .debug (f"{ family } : Default file has no download URL" )
120+ return False
121+
116122 return True
117123
118124
@@ -149,7 +155,7 @@ def fetch_fonts_for_scripts(scripts: List[str]) -> List[str]:
149155 scripts = list ({script .capitalize () for script in scripts })
150156
151157 # Always have the Mui-Language-Picker default/safe fonts.
152- fonts = ["Annapurna SIL" , "Charis SIL " , "Noto Sans TC" , "Scheherazade New" ]
158+ fonts = ["Annapurna SIL" , "Charis" , "Noto Sans TC" , "Scheherazade New" ]
153159
154160 logging .debug (f"Downloading script font table from { url_script_font_table } " )
155161 req = requests .get (url_script_font_table )
@@ -245,9 +251,10 @@ def main() -> None:
245251 font_id : str = font .replace (" " , "" ).lower ()
246252
247253 # Get font family info from font families info, using fallback font if necessary.
254+ family : str = ""
248255 while font_id != "" and font_id in families .keys ():
249256 font_info = families [font_id ]
250- family : str = font_info ["family" ]
257+ family = font_info ["family" ]
251258 source_is_google = "source" in font_info .keys () and font_info ["source" ] == "Google"
252259 get_from_google = source_is_google and not is_for_offline
253260 if check_font_info (font_info ) or get_from_google :
@@ -319,7 +326,7 @@ def main() -> None:
319326
320327 # Finish the css info for this font and write to file.
321328 css_lines .append ("}\n " )
322- css_file_path = args .output / f"{ font } .css"
329+ css_file_path = args .output / f"{ font . replace ( ' ' , '' ) } .css"
323330 logging .debug (f"Writing { css_file_path } " )
324331 with open (css_file_path , "w" ) as css_file :
325332 css_file .writelines (css_lines )
0 commit comments