@@ -6,28 +6,60 @@ UFO Extractor
6
6
7
7
Tools for extracting data from font binaries into UFO objects.
8
8
9
- Features
10
- --------
9
+ Supported input formats
10
+ -----------------------
11
11
12
- Import data into a `Defcon <https://github.com/typesupply/defcon >`__ ``Font ``
13
- instance:
12
+ The following font formats are supported:
13
+
14
+ - CFF or TrueType-flavored OpenType fonts (``*.otf ``, ``*.ttf ``)
15
+ - `FontTools <https://github.com/fonttools/fonttools >`__ TTX files
16
+ (``*.ttx ``)
17
+ - WOFF 1.0/2.0 (``*.woff ``, ``*.woff2 ``)
18
+ - PostScript Type1 fonts (``*.pfa ``, ``*.pfb ``, etc.)
19
+ - FontLab files (``*.vfb ``, when installed with optional dependency "vfb")
20
+
21
+ Note however, that what data will (or even could) be exported will depend on
22
+ input file format and the file itself.
23
+
24
+ Python module
25
+ -------------
26
+
27
+ The example below demonstrates how one can import data into
28
+ a `ufoLib2 <https://github.com/fonttools/ufoLib2/ >`__
29
+ or `Defcon <https://github.com/typesupply/defcon >`__ ``Font `` instance:
14
30
15
31
.. code :: python
16
32
17
33
>> > import extractor
18
- >> > import defcon
19
- >> > ufo = defcon. Font()
34
+ >> > from ufoLib2 import Font # alternatively: from defcon import Font
35
+ >> > ufo = Font()
20
36
>> > extractor.extractUFO(" /path/to/MyFont.ttf" , ufo)
21
37
>> > ufo.save(" /path/to/MyFont.ufo" )
22
38
23
- Supported input formats:
39
+ Console script
40
+ --------------
24
41
25
- - CFF or TrueType-flavored OpenType fonts (``*.otf ``, ``*.ttf ``)
26
- - `FontTools <https://github.com/fonttools/fonttools >`__ TTX files
27
- (``*.ttx ``)
28
- - WOFF 1.0/2.0 (``*.woff ``, ``*.woff2 ``)
29
- - PostScript Type1 fonts (``*.pfa ``, ``*.pfb ``, etc.)
30
- - FontLab files (``*.vfb ``, when installed with optional dependency "vfb")
42
+ A console script for one-off conversion is also provided
43
+ (note: see Installation below):
44
+
45
+ .. code ::
46
+
47
+ $ extractufo -h
48
+ usage: extractufo [-h] [-m {ufoLib2,defcon}] [-z] FONT_FILE [FONT_FILE ...]
49
+
50
+ Extract data from font binaries and build UFO objects from them.
51
+
52
+ positional arguments:
53
+ FONT_FILE Input font path
54
+
55
+ options:
56
+ -h, --help show this help message and exit
57
+ -m {ufoLib2,defcon}, --ufo-module {ufoLib2,defcon}
58
+ Select the default library for writing UFOs (default: autodetect, prefer ufoLib2)
59
+ -z, --zip Output UFO ZIP
60
+
61
+ Each resulting UFO will be saved as FONT_FILE.ufo(z) in the same directory as the original FONT_FILE.
62
+ If destination file or directory already exists, conversion for that source file will be skipped and the application exit code will indicate an error.
31
63
32
64
Installation
33
65
------------
@@ -44,6 +76,20 @@ To install with support for extracting from vfb files:
44
76
45
77
$ pip install ufo-extractor[vfb]
46
78
79
+ If you want to use the console script and have neither `ufoLib2 ` nor `defcon `
80
+ installed (or aren't sure), running the following will install `ufoLib2 ` as well
81
+ to ensure that the script works:
82
+
83
+ .. code ::
84
+
85
+ $ pip install ufo-extractor[script]
86
+
87
+ The options may also be combined:
88
+
89
+ .. code ::
90
+
91
+ $ pip install ufo-extractor[vfb][script]
92
+
47
93
Note that, for historical reasons, the package is listed on the
48
94
`Python Package Index <https://travis-ci.org/typesupply/extractor >`__ under the name
49
95
``ufo-extractor ``, to disambiguate it from another package also called "extractor".
0 commit comments