(
f: str,
get_ttfont: Callable[[str, FontConfig, BuildOption], TTFont],
font_config: FontConfig,
build_option: BuildOption,
)
| 1248 | |
| 1249 | |
| 1250 | def build_nf( |
| 1251 | f: str, |
| 1252 | get_ttfont: Callable[[str, FontConfig, BuildOption], TTFont], |
| 1253 | font_config: FontConfig, |
| 1254 | build_option: BuildOption, |
| 1255 | ): |
| 1256 | print(f"👉 NerdFont{font_config.get_nf_suffix()} version for {f}") |
| 1257 | nf_font = get_ttfont(f, font_config, build_option) |
| 1258 | |
| 1259 | # format font name |
| 1260 | style_compact_nf = f.split("-")[-1].split(".")[0] |
| 1261 | |
| 1262 | style_nf_with_prefix_space, style_in_2, style_in_17, is_skip_sufamily, _ = ( |
| 1263 | parse_style_name( |
| 1264 | style_name_compact=style_compact_nf, |
| 1265 | skip_subfamily_list=build_option.base_subfamily_list, |
| 1266 | ) |
| 1267 | ) |
| 1268 | |
| 1269 | nf_sym = f"NF{font_config.get_nf_suffix()}" |
| 1270 | postscript_name = f"{font_config.family_name_compact}-{nf_sym}-{style_compact_nf}" |
| 1271 | |
| 1272 | update_font_names( |
| 1273 | font=nf_font, |
| 1274 | family_name=f"{font_config.family_name} {nf_sym}{style_nf_with_prefix_space}", |
| 1275 | style_name=style_in_2, |
| 1276 | full_name=f"{font_config.family_name} {nf_sym} {style_in_17}", |
| 1277 | version_str=font_config.version_str, |
| 1278 | postscript_name=postscript_name, |
| 1279 | unique_identifier=get_unique_identifier( |
| 1280 | font_config=font_config, |
| 1281 | postscript_name=postscript_name, |
| 1282 | ), |
| 1283 | is_skip_subfamily=is_skip_sufamily, |
| 1284 | preferred_family_name=f"{font_config.family_name} {nf_sym}", |
| 1285 | preferred_style_name=style_in_17, |
| 1286 | ) |
| 1287 | |
| 1288 | if font_config.line_height != 1: |
| 1289 | adjust_line_height( |
| 1290 | nf_font, font_config.line_height, font_config.vertical_metric |
| 1291 | ) |
| 1292 | |
| 1293 | if not ( |
| 1294 | build_option.should_use_font_patcher(font_config) |
| 1295 | or font_config.get_nf_suffix() == "Propo" |
| 1296 | ): |
| 1297 | verify_glyph_width( |
| 1298 | font=nf_font, |
| 1299 | expect_widths=font_config.get_valid_glyph_width_list(), |
| 1300 | file_name=postscript_name, |
| 1301 | ) |
| 1302 | |
| 1303 | target_path = joinPaths( |
| 1304 | build_option.output_nf, |
| 1305 | f"{postscript_name}.ttf", |
| 1306 | ) |
| 1307 | nf_font.save(target_path) |
nothing calls this directly
no test coverage detected