11use super :: grammar:: {
2- CMapFormat0 ,
3- CMapFormat12 ,
4- CMapFormat4 ,
5- CMapIndividualGroup ,
6- CMapSubtable ,
7- CMapTable ,
8- ComponentGlyph ,
9- ComponentGlyphArgument ,
10- ComponentGlyphFlag ,
11- ComponentGlyphTransformation ,
12- CompoundGlyph ,
13- F2Dot14 ,
14- FWord ,
15- Fixed ,
16- FontDirectory ,
17- Glyph ,
18- GlyphData ,
19- GlyphDescription ,
20- GlyphTable ,
21- HHeaTable ,
22- HMtxTable ,
23- HeadTable ,
24- LongDateTime ,
25- LongHorizontalMetric ,
26- MaxPTable ,
27- OffsetSubTable ,
28- ScalarType ,
29- SimpleGlyph ,
30- SimpleGlyphFlag ,
31- TableRecord ,
32- TableTag ,
33- TrueTypeFontFile ,
34- UnsignedFWord ,
2+ CMapFormat0 , CMapFormat12 , CMapFormat4 , CMapIndividualGroup , CMapSubtable , CMapTable ,
3+ ComponentGlyph , ComponentGlyphArgument , ComponentGlyphFlag , ComponentGlyphTransformation ,
4+ CompoundGlyph , F2Dot14 , FWord , Fixed , FontDirectory , Glyph , GlyphData , GlyphDescription ,
5+ GlyphTable , HHeaTable , HMtxTable , HeadTable , LongDateTime , LongHorizontalMetric , MaxPTable ,
6+ OffsetSubTable , ScalarType , SimpleGlyph , SimpleGlyphFlag , TableRecord , TableTag ,
7+ TrueTypeFontFile , UnsignedFWord ,
358} ;
369use crate :: {
3710 eof,
38- font:: grammar:: {
39- IndexToLocFormat ,
40- Platform ,
41- PlatformDouble ,
42- } ,
11+ font:: grammar:: { IndexToLocFormat , Platform , PlatformDouble } ,
4312 read,
44- util:: read_bytes:: {
45- U16_BYTES ,
46- U32_BYTES ,
47- U64_BYTES ,
48- U8_BYTES ,
49- } ,
50- } ;
51- use anyhow:: {
52- bail,
53- ensure,
54- Result ,
13+ util:: read_bytes:: { U16_BYTES , U32_BYTES , U64_BYTES , U8_BYTES } ,
5514} ;
15+ use anyhow:: { bail, ensure, Result } ;
5616use std:: collections:: BTreeMap ;
5717
5818#[ derive( Debug ) ]
@@ -75,7 +35,7 @@ impl<'a> TrueTypeFontParser<'a> {
7535
7636 let offset = self . cursor ;
7737 let head = self . parse_head_table ( ) ?;
78- assert_eq ! ( self . cursor - offset, head_table_record. length as usize ) ;
38+ debug_assert_eq ! ( self . cursor - offset, head_table_record. length as usize ) ;
7939
8040 head
8141 } ;
@@ -86,7 +46,7 @@ impl<'a> TrueTypeFontParser<'a> {
8646
8747 let offset = self . cursor ;
8848 let hhea = self . parse_hhea_table ( ) ?;
89- assert_eq ! ( self . cursor - offset, hhea_table_record. length as usize ) ;
49+ debug_assert_eq ! ( self . cursor - offset, hhea_table_record. length as usize ) ;
9050
9151 hhea
9252 } ;
@@ -97,7 +57,7 @@ impl<'a> TrueTypeFontParser<'a> {
9757
9858 let offset = self . cursor ;
9959 let maxp = self . parse_maxp_table ( ) ?;
100- assert_eq ! ( self . cursor - offset, maxp_table_record. length as usize ) ;
60+ debug_assert_eq ! ( self . cursor - offset, maxp_table_record. length as usize ) ;
10161
10262 maxp
10363 } ;
@@ -110,7 +70,7 @@ impl<'a> TrueTypeFontParser<'a> {
11070 let loca =
11171 self . parse_loca_table ( & head_table. index_to_loc_format , & maxp_table. num_glyphs ) ?;
11272
113- assert_eq ! ( self . cursor - offset, loca_table_record. length as usize ) ;
73+ debug_assert_eq ! ( self . cursor - offset, loca_table_record. length as usize ) ;
11474
11575 loca
11676 } ;
@@ -122,7 +82,7 @@ impl<'a> TrueTypeFontParser<'a> {
12282 let offset = self . cursor ;
12383 let htmx =
12484 self . parse_hmtx_table ( hhea_table. num_of_long_hor_metrics , maxp_table. num_glyphs ) ?;
125- assert_eq ! ( self . cursor - offset, hmtx_table_record. length as usize ) ;
85+ debug_assert_eq ! ( self . cursor - offset, hmtx_table_record. length as usize ) ;
12686
12787 htmx
12888 } ;
@@ -502,7 +462,7 @@ impl<'a> TrueTypeFontParser<'a> {
502462 glyphs. push ( Glyph { description, data } ) ;
503463 }
504464
505- assert_eq ! ( glyphs. len( ) , num_glyphs) ;
465+ debug_assert_eq ! ( glyphs. len( ) , num_glyphs) ;
506466
507467 Ok ( GlyphTable { glyphs } )
508468 }
0 commit comments