MCPcopy
hub / github.com/microsoft/cascadia-code / prepare_fonts

Function prepare_fonts

build.py:156–185  ·  view source on GitHub ↗
(
    designspace: fontTools.designspaceLib.DesignSpaceDocument, name: str
)

Source from the content-addressed store, hash-verified

154 glyph.flags[0] |= 0x40
155
156def prepare_fonts(
157 designspace: fontTools.designspaceLib.DesignSpaceDocument, name: str
158) -> None:
159 designspace.loadSourceFonts(ufoLib2.Font.open)
160 for source in designspace.sources:
161
162 step_set_feature_file(FEATURES_DIR, name, source.font)
163
164 if "PL" in name or "NF" in name or "Mono" in name:
165 step_set_font_name(name, source.font)
166
167 if "PL" in name or "NF" in name:
168 print(f"[{name} {source.styleName}] Merging PL glyphs")
169 step_merge_glyphs_from_ufo(
170 NERDFONTS_DIR / "NerdfontsPL-Regular.ufo", source.font
171 )
172
173 if "NF" in name:
174 print(f"[{name} {source.styleName}] Merging NF glyphs")
175 for ufo in Path(NERDFONTS_DIR/"full"/"processed").glob("*.ufo"):
176 step_merge_glyphs_from_ufo(
177 ufo, source.font
178 )
179
180 set_font_metaData(source.font)
181 for instance in designspace.instances:
182 instance.name = instance.name.replace("Cascadia Code", name)
183 instance.familyName = instance.familyName.replace("Cascadia Code", name)
184 if instance.styleMapFamilyName:
185 instance.styleMapFamilyName = instance.styleMapFamilyName.replace("Cascadia Code", name)
186
187
188def to_woff2(source_path: Path, target_path: Path) -> None:

Callers 2

build_font_variableFunction · 0.85
build_font_staticFunction · 0.85

Calls 4

step_set_feature_fileFunction · 0.85
step_set_font_nameFunction · 0.85
set_font_metaDataFunction · 0.85

Tested by

no test coverage detected