File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[submodule "pymisp/data/misp-objects "]
22 path = pymisp/data/misp-objects
33 url = https://github.com/MISP/misp-objects
4- [submodule "pymisp/tools/pdf_fonts "]
5- path = pymisp/tools/pdf_fonts
6- url = https://github.com/MISP/pdf_fonts
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1212import sys
1313import os
1414
15+ import requests
16+
1517if sys .version_info .major >= 3 :
1618 from html import escape
1719else :
@@ -410,18 +412,28 @@ def internationalize_font(config=None):
410412 NotoSansCJKtc - Medium.ttf
411413 '''
412414 font_path = Path (sys .modules ['pymisp' ].__file__ ).parent / 'tools' / 'pdf_fonts' / 'Noto_TTF'
413-
414415 noto_bold = font_path / "NotoSansCJKtc-Bold.ttf"
415416 noto = font_path / "NotoSansCJKtc-DemiLight.ttf"
416417
418+ if not font_path .is_dir () or not noto_bold .is_file () or not noto .is_file ():
419+ font_path .mkdir (parents = True , exist_ok = True )
420+ if not noto_bold .is_file ():
421+ bf = requests .get ('https://github.com/MISP/pdf_fonts/raw/refs/heads/master/Noto_TTF/NotoSansCJKtc-Bold.ttf' )
422+ with open (noto_bold , 'wb' ) as f :
423+ f .write (bf .content )
424+ if not noto .is_file ():
425+ rf = requests .get ('https://github.com/MISP/pdf_fonts/raw/refs/heads/master/Noto_TTF/NotoSansCJKtc-DemiLight.ttf' )
426+ with open (noto , 'wb' ) as f :
427+ f .write (rf .content )
428+
417429 if noto_bold .is_file () and noto .is_file ():
418430 registerFont (TTFont ("Noto" , noto ))
419431 registerFont (TTFont ("Noto-bold" , noto_bold ))
420432
421433 FIRST_COL_FONT = 'Noto-bold'
422434 SECOND_COL_FONT = 'Noto'
423435 else :
424- logger .error (f"Trying to load a custom (internationalization) font, unable to access the file: { noto_bold } " )
436+ logger .error (f"Trying to load a custom (internationalization) font, unable to access the file: { noto_bold } / { noto } " )
425437
426438
427439def get_table_styles ():
You can’t perform that action at this time.
0 commit comments