Skip to content

Commit

Permalink
Fix NF Mono glyph selection, NF variants STAT, PL rclt table (#721)
Browse files Browse the repository at this point in the history
The build issue I was running into was caused by the logic that chooses
when to merge Powerline glyphs into the final set before building.

It covered the following conditions:

| Conditions | Outcome                         |
| ---------- | ------------------------------- |
| Mono       | Set name only ✅                |
| Mono + PL  | Set name, merge PL ✅           |
| PL         | Set name, merge PL ✅           |
| NF         | Set name, merge PL, merge NF ✅ |

However, it missed one:

| Conditions | Outcome                         |
| ---------- | ------------------------------- |
| Mono + NF  | ❔❔❔                          | 

I've simplified the logic so that we don't make this mistake again. All
non-Cascadia-Code variants will have their names overridden, and if they
contain PL or NF they will get special treatment.

I've also added the NF variants to the STAT table table and fixed the
generation of rclt for PL variants.
  • Loading branch information
DHowett committed Apr 9, 2024
1 parent 6d61a78 commit d535176
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 19 deletions.
25 changes: 6 additions & 19 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def step_set_feature_file(path: Path, name: str, instance: ufoLib2.Font) -> None
for item in featureList:
if "PL" in name and item == "rclt":
featureSet += Path(path / str("rclt_PL.fea")).read_text()
if "NF" in name and item == "rclt":
elif "NF" in name and item == "rclt":
featureSet += Path(path / str("rclt_PL.fea")).read_text()
elif "Mono" in name and "calt" in item:
featureSet += Path(path / str(item+"_mono.fea")).read_text() #both Italic and Regular can use same mono
Expand Down Expand Up @@ -161,34 +161,21 @@ def prepare_fonts(

step_set_feature_file(FEATURES_DIR, name, source.font)

if "Mono" in name and "PL" in name:
print(f"[{name} {source.styleName}] Merging PL glyphs")
step_merge_glyphs_from_ufo(
NERDFONTS_DIR / "NerdfontsPL-Regular.ufo", source.font
)
if "PL" in name or "NF" in name or "Mono" in name:
step_set_font_name(name, source.font)
elif "Mono" in name:
step_set_font_name(name, source.font)
elif "PL" in name:

if "PL" in name or "NF" in name:
print(f"[{name} {source.styleName}] Merging PL glyphs")
step_merge_glyphs_from_ufo(
NERDFONTS_DIR / "NerdfontsPL-Regular.ufo", source.font
)
step_set_font_name(name, source.font)
elif "NF" in name:

if "NF" in name:
print(f"[{name} {source.styleName}] Merging NF glyphs")
step_merge_glyphs_from_ufo(
NERDFONTS_DIR / "NerdfontsPL-Regular.ufo", source.font
)
for ufo in Path(NERDFONTS_DIR/"full"/"processed").glob("*.ufo"):
step_merge_glyphs_from_ufo(
ufo, source.font
)
step_set_font_name(name, source.font)
elif "Cascadia Code" in name:
pass
else:
print("Variant name not identified. Please check.")

set_font_metaData(source.font)
for instance in designspace.instances:
Expand Down
85 changes: 85 additions & 0 deletions sources/features/rclt_PL.fea
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,91 @@ sub boxVerticalLightAndRightHeavy by boxVerticalLightAndRightHeavy.stypo;
sub boxVerticalSingleAndHorizontalDouble by boxVerticalSingleAndHorizontalDouble.stypo;
sub boxVerticalSingleAndLeftDouble by boxVerticalSingleAndLeftDouble.stypo;
sub boxVerticalSingleAndRightDouble by boxVerticalSingleAndRightDouble.stypo;
sub checkerBoardDeleteAmstradCpc by checkerBoardDeleteAmstradCpc.stypo;
sub checkerBoardFill by checkerBoardFill.stypo;
sub checkerBoardFillInverse by checkerBoardFillInverse.stypo;
sub blockQuadrant-UC by blockQuadrant-UC.stypo;
sub blockQuadrant-LC by blockQuadrant-LC.stypo;
sub blockQuadrant-ML by blockQuadrant-ML.stypo;
sub blockQuadrant-MR by blockQuadrant-MR.stypo;
sub blockTriangle-1 by blockTriangle-1.stypo;
sub blockTriangle-2 by blockTriangle-2.stypo;
sub blockTriangle-3 by blockTriangle-3.stypo;
sub blockTriangle-4 by blockTriangle-4.stypo;
sub blockTriangle-14 by blockTriangle-14.stypo;
sub blockTriangle-23 by blockTriangle-23.stypo;
sub blockTriangle-123 by blockTriangle-123.stypo;
sub blockTriangle-124 by blockTriangle-124.stypo;
sub blockTriangle-134 by blockTriangle-134.stypo;
sub blockTriangle-234 by blockTriangle-234.stypo;
sub blockCircle-1 by blockCircle-1.stypo;
sub blockCircle-2 by blockCircle-2.stypo;
sub blockCircle-3 by blockCircle-3.stypo;
sub blockCircle-4 by blockCircle-4.stypo;
sub blockCircle-UC by blockCircle-UC.stypo;
sub blockCircle-LC by blockCircle-LC.stypo;
sub blockCircle-ML by blockCircle-ML.stypo;
sub blockCircle-MR by blockCircle-MR.stypo;
sub blockSextant-1 by blockSextant-1.stypo;
sub blockSextant-2 by blockSextant-2.stypo;
sub blockSextant-12 by blockSextant-12.stypo;
sub blockSextant-3 by blockSextant-3.stypo;
sub blockSextant-13 by blockSextant-13.stypo;
sub blockSextant-23 by blockSextant-23.stypo;
sub blockSextant-123 by blockSextant-123.stypo;
sub blockSextant-4 by blockSextant-4.stypo;
sub blockSextant-14 by blockSextant-14.stypo;
sub blockSextant-24 by blockSextant-24.stypo;
sub blockSextant-124 by blockSextant-124.stypo;
sub blockSextant-34 by blockSextant-34.stypo;
sub blockSextant-134 by blockSextant-134.stypo;
sub blockSextant-234 by blockSextant-234.stypo;
sub blockSextant-1234 by blockSextant-1234.stypo;
sub blockSextant-5 by blockSextant-5.stypo;
sub blockSextant-15 by blockSextant-15.stypo;
sub blockSextant-25 by blockSextant-25.stypo;
sub blockSextant-125 by blockSextant-125.stypo;
sub blockSextant-35 by blockSextant-35.stypo;
sub blockSextant-235 by blockSextant-235.stypo;
sub blockSextant-1235 by blockSextant-1235.stypo;
sub blockSextant-45 by blockSextant-45.stypo;
sub blockSextant-145 by blockSextant-145.stypo;
sub blockSextant-245 by blockSextant-245.stypo;
sub blockSextant-1245 by blockSextant-1245.stypo;
sub blockSextant-345 by blockSextant-345.stypo;
sub blockSextant-1345 by blockSextant-1345.stypo;
sub blockSextant-2345 by blockSextant-2345.stypo;
sub blockSextant-12345 by blockSextant-12345.stypo;
sub blockSextant-6 by blockSextant-6.stypo;
sub blockSextant-16 by blockSextant-16.stypo;
sub blockSextant-26 by blockSextant-26.stypo;
sub blockSextant-126 by blockSextant-126.stypo;
sub blockSextant-36 by blockSextant-36.stypo;
sub blockSextant-136 by blockSextant-136.stypo;
sub blockSextant-236 by blockSextant-236.stypo;
sub blockSextant-1236 by blockSextant-1236.stypo;
sub blockSextant-46 by blockSextant-46.stypo;
sub blockSextant-146 by blockSextant-146.stypo;
sub blockSextant-1246 by blockSextant-1246.stypo;
sub blockSextant-346 by blockSextant-346.stypo;
sub blockSextant-1346 by blockSextant-1346.stypo;
sub blockSextant-2346 by blockSextant-2346.stypo;
sub blockSextant-12346 by blockSextant-12346.stypo;
sub blockSextant-56 by blockSextant-56.stypo;
sub blockSextant-156 by blockSextant-156.stypo;
sub blockSextant-256 by blockSextant-256.stypo;
sub blockSextant-1256 by blockSextant-1256.stypo;
sub blockSextant-356 by blockSextant-356.stypo;
sub blockSextant-1356 by blockSextant-1356.stypo;
sub blockSextant-2356 by blockSextant-2356.stypo;
sub blockSextant-12356 by blockSextant-12356.stypo;
sub blockSextant-456 by blockSextant-456.stypo;
sub blockSextant-1456 by blockSextant-1456.stypo;
sub blockSextant-2456 by blockSextant-2456.stypo;
sub blockSextant-12456 by blockSextant-12456.stypo;
sub blockSextant-3456 by blockSextant-3456.stypo;
sub blockSextant-13456 by blockSextant-13456.stypo;
sub blockSextant-23456 by blockSextant-23456.stypo;
sub uniE0A0 by uniE0A0.stypo;
sub uniE0B0 by uniE0B0.stypo;
sub uniE0B1 by uniE0B1.stypo;
Expand Down
96 changes: 96 additions & 0 deletions sources/stat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,54 @@ CascadiaCodePL.ttf:
linkedValue: 1
flags: 2
CascadiaCodePLItalic.ttf:
- name: Weight
tag: wght
values:
- name: ExtraLight
value: 200
- name: Light
value: 300
- name: SemiLight
value: 350
- name: Regular
value: 400
linkedValue: 700
flags: 2
- name: SemiBold
value: 600
- name: Bold
value: 700
- name: Italic
tag: ital
values:
- name: Italic
value: 1
CascadiaCodeNF.ttf:
- name: Weight
tag: wght
values:
- name: ExtraLight
value: 200
- name: Light
value: 300
- name: SemiLight
value: 350
- name: Regular
value: 400
linkedValue: 700
flags: 2
- name: SemiBold
value: 600
- name: Bold
value: 700
- name: Italic
tag: ital
values:
- name: Roman
value: 0
linkedValue: 1
flags: 2
CascadiaCodeNFItalic.ttf:
- name: Weight
tag: wght
values:
Expand Down Expand Up @@ -193,3 +241,51 @@ CascadiaMonoPLItalic.ttf:
values:
- name: Italic
value: 1
CascadiaMonoNF.ttf:
- name: Weight
tag: wght
values:
- name: ExtraLight
value: 200
- name: Light
value: 300
- name: SemiLight
value: 350
- name: Regular
value: 400
linkedValue: 700
flags: 2
- name: SemiBold
value: 600
- name: Bold
value: 700
- name: Italic
tag: ital
values:
- name: Roman
value: 0
linkedValue: 1
flags: 2
CascadiaMonoNFItalic.ttf:
- name: Weight
tag: wght
values:
- name: ExtraLight
value: 200
- name: Light
value: 300
- name: SemiLight
value: 350
- name: Regular
value: 400
linkedValue: 700
flags: 2
- name: SemiBold
value: 600
- name: Bold
value: 700
- name: Italic
tag: ital
values:
- name: Italic
value: 1

0 comments on commit d535176

Please sign in to comment.