File tree 2 files changed +39
-6
lines changed
2 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,10 @@ Python Script for Font Manipulation using FontForge Module
6
6
7
7
** Please install python-fontforge module first as well as PyQt5**
8
8
9
- # [ minimizeFont.py] ( ../../blob/master/minimizeFont.py )
10
9
11
- Python script that minimize ttf font by input word list
10
+ # [ checkMissingGlyph.py ] ( ../../blob/master/checkMissingGlyph.py )
12
11
13
- Use [ minifyGlyphs ] ( ../../blob/master/minifyGlyphs ) as input word list
12
+ Check Missing Glyph in word list [ missingGlyphs ] ( ../../blob/master/missingGlyphs )
14
13
15
14
Word list format
16
15
```
33
32
C D
34
33
```
35
34
36
- # [ checkMissingGlyph .py] ( ../../blob/master/checkMissingGlyph .py )
35
+ # [ getChineseFontName .py] ( ../../blob/master/getChineseFontName .py )
37
36
38
- Check Missing Glyph in word list [ missingGlyphs] ( ../../blob/master/missingGlyphs )
37
+ Get all TTFs' Chinese Font Name in current folder.
38
+
39
+ Print out sample.
40
+ ```
41
+ ?.ttf as {chinese_name}_{english_name}
42
+ ```
43
+
44
+ # [ minimizeFont.py] ( ../../blob/master/minimizeFont.py )
45
+
46
+ Python script that minimize ttf font by input word list
47
+
48
+ Use [ minifyGlyphs] ( ../../blob/master/minifyGlyphs ) as input word list
39
49
40
50
Word list format
41
51
```
42
52
## start with "##" line will be ignore to read
43
53
A
44
54
B
45
55
C
46
- ```
56
+ ```
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ import fontforge
4
+ import glob
5
+
6
+ fonts = glob .glob ("*.ttf" )
7
+
8
+ for f in fonts :
9
+ ttfFile = fontforge .open (f , 5 )
10
+ chinesename = ""
11
+ for item in ttfFile .sfnt_names :
12
+ (a , b , c ) = item
13
+ if a == 'Chinese (PRC)' and b == 'Fullname' :
14
+ chinesename = c
15
+ if a == 'Chinese (Taiwan)' and b == 'Fullname' :
16
+ chinesename = c
17
+ if a == 'Chinese (Hong Kong)' and b == 'Fullname' :
18
+ chinesename = c
19
+
20
+ # print("cp shortname/" + f + " " + c+'_' +
21
+ # (ttfFile.fullname).replace(' ', '') + ".ttf")
22
+ print (f .replace (' ' , '\\ ' ) + " as " + chinesename +
23
+ "_" + ttfFile .fullname .replace (' ' , '_' ))
You can’t perform that action at this time.
0 commit comments