--family is ignored for font.familyname; FontForge/potrace failures exit 0
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 72/100
Research direction
Start with handwrite/svgtottf.py, especially set_properties() and its subprocess calls, then inspect handwrite/pngtosvg.py and handwrite/cli.py converters(). Verify the family and sfnt_names cases, conversion failures, cleanup on exceptions, and creation of a missing output directory. Done means each reported failure is surfaced and temporary resources are cleaned up.
Written by the indexing model from the issue text.
Description
I found a few correctness issues in the font-generation pipeline. They look distinct from #92 (alpha threshold) and #83/#82 (FontForge missing).
1. --family does not set the font’s internal family name
In handwrite/svgtottf.py set_properties() (around lines 47–55):
family = self.metadata.get("family", None) or fontname
self.font.familyname = fontname # uses --filename, not --family
--family is written into SFNT names when sfnt_names exists (lines 64–67), but self.font.familyname always uses fontname (--filename / config). Installed fonts then show the wrong family in font pickers.
Fix: self.font.familyname = family, and keep fontname / fullname consistent with the SFNT names.
2. FontForge and potrace failures are ignored
svgtottf.pylines 28–41:subprocess.run(...)with nocheck=Trueand no return-code check. Ifffpython/fontforgefails, the CLI can still exit 0 with no.ttf.pngtosvg.pyline 48: same forpotrace.
Fix: subprocess.run(..., check=True, capture_output=True) and surface stderr. You already raise PotraceNotFound when the binary is missing; a failed conversion should be just as visible.
3. Missing sfnt_names in a custom config → KeyError
Lines 64–68 guard updates to sfnt_names, but line 70 always does:
self.config["sfnt_names"]["UniqueID"] = ...
A minimal config without sfnt_names crashes.
Fix: self.config.setdefault("sfnt_names", {}) before writing UniqueID.
4. Temp directory leaked on failure
handwrite/cli.py converters() (lines 17–37) creates tempfile.mkdtemp() when --directory is omitted, and only rmtrees it if run() succeeds. Any exception in SHEETtoPNG / PNGtoSVG / SVGtoTTF leaves the temp dir behind.
Fix: try/finally around run().
Also, output_directory is never makedirs’d; a missing output path fails late inside FontForge.
Happy to open a PR if you want.
- Dominant language
- Python
- Stars
- 544
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yashlamba/handwrite
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Add requirements.txtOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
All issues in yashlamba/handwrite
Similar issues
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 82/100
EclipseFdn/open-vsx.org#13573 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
collective/icalendar#1854 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rancher/rancher-ai-agent#412 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
TUDelftGeodesy/DePSI#134 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HenriquesLab/rxiv-maker#335 ·