22For usage instructions, see:
33 https://kolibri-dev.readthedocs.io/en/develop/references/i18n.html
44"""
5+
56import argparse
67import base64
78import functools
3233 utils .install_requirement (f"fonttools=={ font_tools_version } " )
3334except AssertionError :
3435 utils .install_requirement (f"fonttools=={ font_tools_version } " )
35- logging .error (
36- "Wrong fontTools version was installed. This has been updated. Please re-run the command."
37- )
36+ logging .error ("Wrong fontTools version was installed. This has been updated. Please re-run the command." )
3837 sys .exit (1 )
3938
4039import noto_source # noqa E402
@@ -328,9 +327,7 @@ def _full_font_face(font_family, font_name, weight, omit_glyphs=None):
328327 glyphs = _font_glyphs (hashed_path ) - omit_glyphs
329328 if not glyphs :
330329 return ""
331- return _gen_font_face (
332- font_family , hashed_filename , weight , unicodes = _fmt_range (glyphs )
333- )
330+ return _gen_font_face (font_family , hashed_filename , weight , unicodes = _fmt_range (glyphs ))
334331
335332
336333def _gen_full_css_modern (lang_info ):
@@ -345,11 +342,7 @@ def _gen_full_css_modern(lang_info):
345342 font_faces = []
346343 for font_name in _font_priorities (lang_info [utils .KEY_DEFAULT_FONT ]):
347344 for weight in noto_source .WEIGHTS :
348- font_faces .append (
349- _full_font_face (
350- SCOPE_FULL , font_name , weight , omit_glyphs = previous_glyphs
351- )
352- )
345+ font_faces .append (_full_font_face (SCOPE_FULL , font_name , weight , omit_glyphs = previous_glyphs ))
353346
354347 # Assumes all four variants have the same glyphs, from the content Regular font
355348 regular_path = _woff_font_path (_scoped (SCOPE_FULL , font_name ), "Regular" )
@@ -358,9 +351,7 @@ def _gen_full_css_modern(lang_info):
358351 hashed_path = os .path .join (OUTPUT_PATH , hashed_filename )
359352 previous_glyphs |= _font_glyphs (hashed_path )
360353
361- original_filename = "{}.modern.css" .format (
362- _scoped (SCOPE_FULL , lang_info [utils .KEY_INTL_CODE ])
363- )
354+ original_filename = "{}.modern.css" .format (_scoped (SCOPE_FULL , lang_info [utils .KEY_INTL_CODE ]))
364355 temp_path = os .path .join (OUTPUT_PATH , original_filename + ".tmp" )
365356
366357 # Write to temporary file
@@ -380,9 +371,7 @@ def _gen_full_css_modern(lang_info):
380371
381372
382373def _gen_full_css_basic (lang_info ):
383- original_filename = "{}.basic.css" .format (
384- _scoped (SCOPE_FULL , lang_info [utils .KEY_INTL_CODE ])
385- )
374+ original_filename = "{}.basic.css" .format (_scoped (SCOPE_FULL , lang_info [utils .KEY_INTL_CODE ]))
386375 temp_path = os .path .join (OUTPUT_PATH , original_filename + ".tmp" )
387376
388377 # Write to temporary file
@@ -493,9 +482,7 @@ def _write_inline_font(file_object, font_path, font_family, weight):
493482 """
494483 with open (font_path , mode = "rb" ) as f :
495484 data = f .read ()
496- data_uri = "data:application/x-font-woff;charset=utf-8;base64,\\ \n {}" .format (
497- "\\ \n " .join (_chunks (base64 .b64encode (data ).decode ()))
498- )
485+ data_uri = "data:application/x-font-woff;charset=utf-8;base64,\\ \n {}" .format ("\\ \n " .join (_chunks (base64 .b64encode (data ).decode ())))
499486 glyphs = _font_glyphs (font_path )
500487 if not glyphs :
501488 return
@@ -658,7 +645,6 @@ def _subset_and_merge_fonts(text, default_font, scope):
658645 remaining_glyphs = set ([ord (c ) for c in text ])
659646
660647 for font_name in _font_priorities (default_font ):
661-
662648 if font_name in FONTS_TO_EXCLUDE_FROM_SUBSET :
663649 continue
664650
0 commit comments