fontcustom 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/fontcustom/scripts/generate.py +21 -9
- data/lib/fontcustom/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
import fontforge
|
2
2
|
import os
|
3
|
-
import argparse
|
4
3
|
import md5
|
5
4
|
import json
|
6
5
|
import subprocess
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
parser.
|
11
|
-
parser.add_argument('
|
12
|
-
|
7
|
+
try:
|
8
|
+
import argparse
|
9
|
+
parser = argparse.ArgumentParser(description='Convert a directory of svg and eps files into a unified font file.')
|
10
|
+
parser.add_argument('dir', metavar='directory', type=unicode, nargs=2, help='directory of vector files')
|
11
|
+
parser.add_argument('--name', metavar='fontname', type=unicode, nargs='?', default='fontcustom', help='reference name of the font (no spaces)')
|
12
|
+
parser.add_argument('--nohash', '-n', action='store_true', help='disable hash fingerprinting of font files')
|
13
|
+
args = parser.parse_args()
|
14
|
+
indir = args.dir[0]
|
15
|
+
outdir = args.dir[1]
|
16
|
+
except ImportError:
|
17
|
+
# Older Pythons don't have argparse, so we use optparse instead
|
18
|
+
import optparse
|
19
|
+
parser = optparse.OptionParser(description='Convert a directory of svg and eps files into a unified font file.')
|
20
|
+
parser.add_option('--name', metavar='fontname', type='string', nargs='?', default='fontcustom', help='reference name of the font (no spaces)')
|
21
|
+
parser.add_option('--nohash', '-n', action='store_true', help='disable hash fingerprinting of font files')
|
22
|
+
(args, posargs) = parser.parse_args()
|
23
|
+
indir = posargs[0]
|
24
|
+
outdir = posargs[1]
|
13
25
|
|
14
26
|
f = fontforge.font()
|
15
27
|
f.encoding = 'UnicodeFull'
|
@@ -20,7 +32,7 @@ files = []
|
|
20
32
|
|
21
33
|
KERNING = 15
|
22
34
|
|
23
|
-
for dirname, dirnames, filenames in os.walk(
|
35
|
+
for dirname, dirnames, filenames in os.walk(indir):
|
24
36
|
for filename in filenames:
|
25
37
|
name, ext = os.path.splitext(filename)
|
26
38
|
filePath = os.path.join(dirname, filename)
|
@@ -42,10 +54,10 @@ for dirname, dirnames, filenames in os.walk(args.dir[0]):
|
|
42
54
|
cp += 1
|
43
55
|
|
44
56
|
if args.nohash:
|
45
|
-
fontfile =
|
57
|
+
fontfile = outdir + '/' + args.name
|
46
58
|
else:
|
47
59
|
hashStr = m.hexdigest()
|
48
|
-
fontfile =
|
60
|
+
fontfile = outdir + '/' + args.name + '-' + hashStr
|
49
61
|
|
50
62
|
f.fontname = args.name
|
51
63
|
f.familyname = args.name
|
data/lib/fontcustom/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontcustom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|