MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / download_remote_fonts

Function download_remote_fonts

pdf2zh/high_level.py:400–425  ·  view source on GitHub ↗
(lang: str)

Source from the content-addressed store, hash-verified

398
399
400def download_remote_fonts(lang: str):
401 lang = lang.lower()
402 LANG_NAME_MAP = {
403 **{la: "GoNotoKurrent-Regular.ttf" for la in noto_list},
404 **{
405 la: f"SourceHanSerif{region}-Regular.ttf"
406 for region, langs in {
407 "CN": ["zh-cn", "zh-hans", "zh"],
408 "TW": ["zh-tw", "zh-hant"],
409 "JP": ["ja"],
410 "KR": ["ko"],
411 }.items()
412 for la in langs
413 },
414 }
415 font_name = LANG_NAME_MAP.get(lang, "GoNotoKurrent-Regular.ttf")
416
417 # docker
418 font_path = ConfigManager.get("NOTO_FONT_PATH", Path("/app", font_name).as_posix())
419 if not Path(font_path).exists():
420 font_path, _ = get_font_and_metadata(font_name)
421 font_path = font_path.as_posix()
422
423 logger.info(f"use font: {font_path}")
424
425 return font_path

Callers 2

yadt_mainFunction · 0.90
translate_streamFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected