googlefonts / googlefonts/gftools

`NinjaBuilder` doesn't create instance TTFs, only makes (unwanted) instance UFOs

Open
#849 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
283
Forks
73
Avg merge
21h 25m
Merged PRs (30d)
8

Description

Example config:

```yml
buildOTF: false
buildStatic: true
buildWebfont: false
familyName: Comic Sans
instances:
Comic Sans[GRAD,ROND,opsz,slnt,wdth,wght].ttf:
- coordinates:
ROND: 0
opsz: 144
wdth: 100
wght: 100.0
familyName: Comic Sans
styleName: Thin
removeOutlineOverlaps: false
reverseOutlineDirection: false
sources:
- Comic Sans.designspace
stat:
# -- snip --
```

---

With `GFBuilder`, this works as I expect:
1. The VF is compiled
2. The static instances defined in the designspace and in the config.yaml are built

With the `NinjaBuilder`, the following happens:
1. The VF is compiled
2. Instance UFOs are generated and put into the `sources/instance_ufos` directory (unwanted)

No errors in either case, but very different behaviour

---

I had a look why the `NinjaBuilder` wasn't producing static TTFs in the debugger and think I found why:

https://github.com/googlefonts/gftools/blob/6997cbac9fc56043cd0fe109c72398091a598506/Lib/gftools/builder/_ninja.py#L303-L321

Here we can see that `NinjaBuilder.build_static` unconditionally generates instance UFOs, and then delegates to `GFBuilder.build_static`, but overriding `self` as the `NinjaBuilder`

https://github.com/googlefonts/gftools/blob/6997cbac9fc56043cd0fe109c72398091a598506/Lib/gftools/builder/__init__.py#L462-L469

`GFBuilder` then delegates to `self.instantiate_static_fonts`, but `self` in this context is `NinjaBuilder`, which...

https://github.com/googlefonts/gftools/blob/6997cbac9fc56043cd0fe109c72398091a598506/Lib/gftools/builder/_ninja.py#L323-L324

Ah. Perhaps this was intended to be `GFBuilder.instantiate_static_fonts`, instead of `NinjaBuilder`'s stub?

This would be easy to workaround if there was a way to manually override the builder being used, but as far as I know there isn't, meaning I either have to change operating system or the source code to avoid the `NinjaBuilder` for now

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.