Skip to content

Commit 38d85e7

Browse files
committed
update documentation and version
1 parent f83bd7b commit 38d85e7

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name='ttf2web',
12-
version='1.0.0',
12+
version='0.9.0',
1313
description='A sample Python project',
1414
long_description=long_description,
1515
url='https://github.com/johncf/ttf2web',

ttf2web.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ def getDefaultRanges():
3232

3333
class TTF2Web:
3434
def __init__(self, fontfile, uranges, assetdir="assets", fontstyle=None, fontweight=None):
35+
"""
36+
Parameters
37+
----------
38+
fontfile : str
39+
Path to a ttf file.
40+
uranges : [[str]]
41+
Array of pairs -- name of the unicode range and the range itself.
42+
These will be used to suffix the names of generated woff2 files.
43+
E.g. [['greek', 'U+0370-03FF,U+1F00-1FFF'], ['thumbs', 'U+01F44D']]
44+
If fontfile='/path/to/fontfile.ttf' and assetdir='assets'
45+
then 'assets/fontfile.greek.woff2' and
46+
'assets/fontfile.thumbs.woff2'
47+
will be generated when the generateWoff2 method is called.
48+
assetdir : str
49+
Path to which woff2 files should be generated.
50+
fontstyle : str
51+
The CSS3 font-style property. If not specified, an appropriate one
52+
will be generated based on the subfamily property[1].
53+
fontweight : str
54+
The CSS3 font-weight property. If not specified, an appropriate one
55+
will be generated based on the subfamily property[1].
56+
57+
[1]: https://www.microsoft.com/typography/otspec/name.htm#nameIDs
58+
"""
3559
self.fontfile = fontfile
3660
self.basename = os.path.splitext(os.path.basename(fontfile))[0]
3761
self.urdict = _intoURDict(uranges)
@@ -101,10 +125,14 @@ def main():
101125
parser = argparse.ArgumentParser()
102126
parser.add_argument("fontfile",
103127
help="ttf file to split into woff2 files")
104-
parser.add_argument("--unicode-ranges", dest="urfile", default=None,
105-
help="the file containing the desired unicode ranges")
106128
parser.add_argument("-v", "--verbose", action="store_true",
107129
help="print more details")
130+
parser.add_argument("--unicode-ranges", dest="urfile", default=None,
131+
help="the file specifying the desired unicode ranges. " +
132+
"Each line of the file should contain 2 fields " +
133+
"separated by one or more spaces. The first field " +
134+
"should be a name given to the unicode range " +
135+
"specified in the second field.")
108136
args = parser.parse_args()
109137
if args.urfile:
110138
uranges = readURFile(args.urfile)

0 commit comments

Comments
 (0)