@@ -3,7 +3,10 @@ use fontations::{
33 skrifa:: { font:: FontRef , string:: StringId } ,
44} ;
55use fontspector_checkapi:: { prelude:: * , skip, testfont, FileTypeConvert } ;
6- use std:: { collections:: { HashMap , HashSet } , vec} ;
6+ use std:: {
7+ collections:: { HashMap , HashSet } ,
8+ vec,
9+ } ;
710
811#[ check(
912 id = "fontwerk/name_entries" ,
@@ -89,15 +92,12 @@ fn name_entries(f: &Testable, context: &Context) -> CheckFnResult {
8992 - Typographic Subfamily Name (17)
9093 - Variations PostScript Name Prefix (25) (if variable font)
9194 " ,
92- title = "Required name ids in name table" ,
95+ title = "Required name ids in name table"
9396) ]
9497fn required_name_ids ( t : & Testable , context : & Context ) -> CheckFnResult {
9598 let font = testfont ! ( t) ;
9699 if !font. has_table ( b"name" ) {
97- return Ok ( Status :: just_one_fail (
98- "lacks-table" ,
99- "No name table." ,
100- ) ) ;
100+ return Ok ( Status :: just_one_fail ( "lacks-table" , "No name table." ) ) ;
101101 }
102102 let mut bad_names: Vec < String > = vec ! [ ] ;
103103
@@ -108,13 +108,9 @@ fn required_name_ids(t: &Testable, context: &Context) -> CheckFnResult {
108108 let mut missing_name_ids: Vec < _ > = vec ! [ ] ;
109109 for id in vec ! [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 16 , 17 , 25 ] {
110110 let name_id = StringId :: from ( id) ;
111- if let Some ( _name_string) = get_name_entry_string (
112- & font. font ( ) ,
113- code. 0 ,
114- code. 1 ,
115- code. 2 ,
116- name_id,
117- ) {
111+ if let Some ( _name_string) =
112+ get_name_entry_string ( & font. font ( ) , code. 0 , code. 1 , code. 2 , name_id)
113+ {
118114 continue ;
119115 } else {
120116 if id == 25 && !font. is_variable_font ( ) {
@@ -147,7 +143,6 @@ fn required_name_ids(t: &Testable, context: &Context) -> CheckFnResult {
147143 } )
148144}
149145
150-
151146#[ check(
152147 id = "fontwerk/name_consistency" ,
153148 rationale = "
@@ -512,5 +507,4 @@ mod tests {
512507 let expected_message = "The following issues have been found:\n \n * Missing required name IDs [7, 10, 16, 17] for (1, 0, 0).\n * Missing required name IDs [7, 10, 16, 17] for (3, 1, 1033)." ;
513508 assert_eq ! ( result. message, Some ( expected_message. to_string( ) ) ) ;
514509 }
515-
516510}
0 commit comments