(f: str, font_config: FontConfig, build_option: BuildOption)
| 1045 | |
| 1046 | |
| 1047 | def build_mono(f: str, font_config: FontConfig, build_option: BuildOption): |
| 1048 | print(f"👉 Minimal version for {f}") |
| 1049 | source_path = joinPaths(build_option.output_ttf, f) |
| 1050 | |
| 1051 | run(f"ftcli fix italic-angle {source_path}") |
| 1052 | run(f"ftcli fix monospace {source_path}") |
| 1053 | run(f"ftcli name strip-names {source_path}") |
| 1054 | run(f"ftcli font correct-contours {source_path}") |
| 1055 | run(f"ftcli ttf dehint {source_path}") |
| 1056 | run(f"ftcli fix transformed-components {source_path}") |
| 1057 | |
| 1058 | font = TTFont(source_path) |
| 1059 | |
| 1060 | style_compact = f.split("-")[-1].split(".")[0] |
| 1061 | |
| 1062 | style_with_prefix_space, style_in_2, style_in_17, is_skip_subfamily, is_italic = ( |
| 1063 | parse_style_name( |
| 1064 | style_name_compact=style_compact, |
| 1065 | skip_subfamily_list=build_option.base_subfamily_list, |
| 1066 | ) |
| 1067 | ) |
| 1068 | |
| 1069 | postscript_name = f"{font_config.family_name_compact}-{style_compact}" |
| 1070 | |
| 1071 | update_font_names( |
| 1072 | font=font, |
| 1073 | family_name=font_config.family_name + style_with_prefix_space, |
| 1074 | style_name=style_in_2, |
| 1075 | full_name=f"{font_config.family_name} {style_in_17}", |
| 1076 | version_str=font_config.version_str, |
| 1077 | postscript_name=postscript_name, |
| 1078 | unique_identifier=get_unique_identifier( |
| 1079 | font_config=font_config, |
| 1080 | postscript_name=postscript_name, |
| 1081 | ), |
| 1082 | is_skip_subfamily=is_skip_subfamily, |
| 1083 | preferred_family_name=font_config.family_name, |
| 1084 | preferred_style_name=style_in_17, |
| 1085 | ) |
| 1086 | |
| 1087 | # https://github.com/ftCLI/FoundryTools-CLI/issues/166#issuecomment-2095433585 |
| 1088 | if style_with_prefix_space == " Thin": |
| 1089 | font["OS/2"].usWeightClass = 250 # type: ignore |
| 1090 | elif style_with_prefix_space == " ExtraLight": |
| 1091 | font["OS/2"].usWeightClass = 275 # type: ignore |
| 1092 | |
| 1093 | font_config.patch_font_feature( |
| 1094 | font=font, |
| 1095 | issue_fea_dir=build_option.output_dir, |
| 1096 | is_italic=is_italic, |
| 1097 | is_cn=False, |
| 1098 | is_variable=False, |
| 1099 | is_hinted=False, |
| 1100 | fea_path=build_option.get_feature_file_path(is_italic), |
| 1101 | ) |
| 1102 | |
| 1103 | verify_glyph_width( |
| 1104 | font=font, |
nothing calls this directly
no test coverage detected