Skip to content

Commit 27387a0

Browse files
authored
Merge pull request #909 from NightFurySL2001/main
Minor improvements on UFOZ files
2 parents 5b71463 + 8d09a9b commit 27387a0

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

Lib/fontmake/__main__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ def parse_mutually_exclusive_inputs(parser, args):
132132
if designspace_path:
133133
parser.error("Only one *.designspace source file is allowed")
134134
designspace_path = filename
135-
elif (filename.endswith(".ufo") and os.path.isdir(filename)) or (
136-
filename.endswith(".ufoz") and os.path.isfile(filename)
137-
):
135+
elif (
136+
os.path.normpath(filename).endswith(".ufo") and os.path.isdir(filename)
137+
) or (filename.endswith(".ufoz") and os.path.isfile(filename)):
138138
ufo_paths.append(filename)
139139
else:
140140
parser.error(f"Unknown input file extension: {filename!r}")

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ There are two ways to specify the source file or files:
4040

4141
One can either use the following, mutually exclusive, flags:
4242
* `-g filename.glyphs`: Converts a Glyphs source file to binary.
43-
* `-u filename.ufo ...`: Converts one or more UFO files to binary.
43+
* `-u filename.ufo ...`: Converts one or more UFO(Z) files to binary.
4444
* `-m filename.designspace`: Converts a Designspace file to binary. (The `-m` is for `mutatormath`, an old Python library for handling designspaces.)
4545

4646
Alternatively, one can specify the input(s) as positional arguments without the flag, letting fontmake infer the source format from the file extension: e.g. ``fontmake MyFont.designspace``, etc.
@@ -70,7 +70,7 @@ The following output file formats are also available, but are generally used int
7070

7171
* `otf-interpolatable`: OTF binaries suitable for merging into a variable font. Placed in the `master_otf_interpolatable/` directory. (These differ from `otf` in that the outlines are unoptimized.)
7272
* `ttf-interpolatable`: TTF binaries suitable for merging into a variable font. Placed in the `master_ttf_interpolatable/` directory. (The outlines are converted to quadratic curves in an interpolation-compatible way.)
73-
* `ufo`: Glyphs sources can be converted to UFO. Placed in the `master_ufo/` directory.
73+
* `ufo`: Glyphs sources can be converted to UFO, or to UFO zip (`.ufoz`) format with the flag `--save-ufo-as-zip`. Placed in the `master_ufo/` directory.
7474

7575
If no format option is specified, the default is `-o otf ttf`.
7676

2.2 KB
Binary file not shown.
2.99 KB
Binary file not shown.

tests/test_main.py

+15
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,21 @@ def test_ufo_to_static_otf_cff2(data_dir, tmp_path):
709709
assert {p.name for p in tmp_path.glob("*.otf")} == {"MyFont-Light.otf"}
710710

711711

712+
def test_ufoz_to_static_otf_cff2(data_dir, tmp_path):
713+
fontmake.__main__.main(
714+
[
715+
"-u",
716+
str(data_dir / "DesignspaceTest" / "MyFont-Light.ufoz"),
717+
"-o",
718+
"otf-cff2",
719+
"--output-dir",
720+
str(tmp_path),
721+
]
722+
)
723+
724+
assert {p.name for p in tmp_path.glob("*.otf")} == {"MyFont-Light.otf"}
725+
726+
712727
def test_static_otf_cffsubr_subroutinizer(data_dir, tmp_path):
713728
fontmake.__main__.main(
714729
[

0 commit comments

Comments
 (0)