File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed
Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change 1- use std:: { collections:: BTreeSet } ;
1+ use std:: { collections:: BTreeSet , path :: PathBuf , str :: FromStr } ;
22
33pub struct CharsetRequest {
44 pub ascii : bool ,
55 pub schinese1 : bool ,
66 pub schinese2 : bool ,
7- pub schinese3 : bool
7+ pub schinese3 : bool ,
8+ pub additional : Vec < PathBuf >
89}
910
1011impl CharsetRequest {
@@ -27,6 +28,16 @@ impl CharsetRequest {
2728 x. schinese3 = true ;
2829 }
2930
31+ if arg. is_present ( "charset" ) {
32+ x. additional =
33+ arg
34+ . values_of ( "charset" )
35+ . unwrap ( )
36+ . map ( PathBuf :: from_str)
37+ . map ( Result :: unwrap)
38+ . collect ( )
39+ }
40+
3041 x
3142 }
3243
@@ -35,7 +46,8 @@ impl CharsetRequest {
3546 ascii : true ,
3647 schinese1 : false ,
3748 schinese2 : false ,
38- schinese3 : false
49+ schinese3 : false ,
50+ additional : vec ! [ ]
3951 }
4052 }
4153
@@ -58,6 +70,10 @@ impl CharsetRequest {
5870 s. push_str ( include_str ! ( "./charset/common-standard-chinese-characters-table/level-3.txt" ) ) ;
5971 }
6072
73+ for i in & self . additional {
74+ s. push_str ( & std:: fs:: read_to_string ( i) . unwrap ( ) ) ;
75+ }
76+
6177 s. chars ( ) . filter ( |x| * x != '\n' && * x != '\r' ) . collect ( )
6278 }
6379}
Original file line number Diff line number Diff line change @@ -122,7 +122,14 @@ fn main() {
122122 . arg ( Arg :: with_name ( "padding-y" )
123123 . long ( "padding-y" )
124124 . default_value ( "24" )
125- . help ( "Padding Y on every basic character in pixels" ) ) ) ;
125+ . help ( "Padding Y on every basic character in pixels" ) )
126+ . arg ( Arg :: with_name ( "charset" )
127+ . long ( "charset" )
128+ . short ( "c" )
129+ . multiple ( true )
130+ . required ( false )
131+ . takes_value ( true )
132+ . help ( "Additional charset to generate" ) ) ) ;
126133
127134 if std:: env:: args ( ) . nth ( 1 ) == None {
128135 app. print_help ( ) . unwrap ( ) ;
@@ -367,22 +374,6 @@ fn font(args: &ArgMatches) {
367374
368375 threads
369376 } ) . collect ( ) ;
370-
371- {
372- let ref mut p = progress_bar. lock ( ) . unwrap ( ) ;
373-
374- p. print_info (
375- "Info" ,
376- & format ! ( "Stride: {}" , stride) ,
377- Color :: Green ,
378- Style :: Bold ) ;
379-
380- p. print_info (
381- "Info" ,
382- & format ! ( "Search Radius: {}" , search_radius) ,
383- Color :: Green ,
384- Style :: Bold ) ;
385- }
386377
387378 for i in charset {
388379 let mut task = task. lock ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments