File tree 4 files changed +12
-9
lines changed
4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -133,13 +133,15 @@ impl<'a> hb_font_t<'a> {
133
133
}
134
134
135
135
pub ( crate ) fn get_nominal_glyph ( & self , c : u32 ) -> Option < GlyphId > {
136
- self . font . nominal_glyph ( c) . map ( |gid| GlyphId ( gid. to_u16 ( ) ) )
136
+ self . font
137
+ . nominal_glyph ( c)
138
+ . map ( |gid| GlyphId ( gid. to_u32 ( ) as u16 ) ) // TODO: remove as u16 when fully on read-fonts GlyphId
137
139
}
138
140
139
141
pub ( crate ) fn glyph_variation_index ( & self , c : char , vs : char ) -> Option < GlyphId > {
140
142
self . font
141
143
. nominal_variant_glyph ( c as u32 , vs as u32 )
142
- . map ( |gid| GlyphId ( gid. to_u16 ( ) ) )
144
+ . map ( |gid| GlyphId ( gid. to_u32 ( ) as u16 ) ) // TODO: remove as u16 when fully on read-fonts GlyphId
143
145
}
144
146
145
147
pub ( crate ) fn glyph_h_advance ( & self , glyph : GlyphId ) -> i32 {
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ fn find_second_glyph<'a>(
104
104
while lo < hi {
105
105
let mid = ( lo + hi) / 2 ;
106
106
let record_offset = set_offset + 2 + mid * record_size;
107
- let glyph_id = base_data. read_at :: < skrifa:: GlyphId > ( record_offset) . ok ( ) ?;
107
+ let glyph_id = base_data. read_at :: < skrifa:: GlyphId16 > ( record_offset) . ok ( ) ?;
108
108
if glyph_id < second_glyph {
109
109
lo = mid + 1
110
110
} else if glyph_id > second_glyph {
@@ -119,7 +119,7 @@ fn find_second_glyph<'a>(
119
119
120
120
impl Apply for PairPosFormat2 < ' _ > {
121
121
fn apply ( & self , ctx : & mut hb_ot_apply_context_t ) -> Option < ( ) > {
122
- let first_glyph = ctx. buffer . cur ( 0 ) . as_skrifa_glyph ( ) ;
122
+ let first_glyph = ctx. buffer . cur ( 0 ) . as_skrifa_glyph16 ( ) ;
123
123
self . coverage ( ) . ok ( ) ?. get ( first_glyph) ?;
124
124
125
125
let mut iter = skipping_iterator_t:: new ( ctx, ctx. buffer . idx , false ) ;
@@ -132,7 +132,7 @@ impl Apply for PairPosFormat2<'_> {
132
132
}
133
133
134
134
let second_glyph_index = iter. index ( ) ;
135
- let second_glyph = ctx. buffer . info [ second_glyph_index] . as_skrifa_glyph ( ) ;
135
+ let second_glyph = ctx. buffer . info [ second_glyph_index] . as_skrifa_glyph16 ( ) ;
136
136
137
137
let finish = |ctx : & mut hb_ot_apply_context_t , iter_index : & mut usize , has_record2| {
138
138
if has_record2 {
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ impl WouldApply for MultipleSubstFormat1<'_> {
20
20
21
21
impl Apply for MultipleSubstFormat1 < ' _ > {
22
22
fn apply ( & self , ctx : & mut hb_ot_apply_context_t ) -> Option < ( ) > {
23
- let glyph = ctx. buffer . cur ( 0 ) . as_glyph ( ) . 0 ;
24
- let index = self . coverage ( ) . ok ( ) ?. get ( skrifa :: GlyphId :: new ( glyph ) ) ? as usize ;
23
+ let gid = ctx. buffer . cur ( 0 ) . as_skrifa_glyph16 ( ) ;
24
+ let index = self . coverage ( ) . ok ( ) ?. get ( gid ) ? as usize ;
25
25
let substs = self . sequences ( ) . get ( index) . ok ( ) ?. substitute_glyph_ids ( ) ;
26
26
match substs. len ( ) {
27
27
// Spec disallows this, but Uniscribe allows it.
Original file line number Diff line number Diff line change @@ -5,17 +5,18 @@ use ttf_parser::GlyphId;
5
5
6
6
impl WouldApply for SingleSubstFormat1 < ' _ > {
7
7
fn would_apply ( & self , ctx : & WouldApplyContext ) -> bool {
8
+ let gid = skrifa:: GlyphId :: from ( ctx. glyphs [ 0 ] . 0 ) ;
8
9
ctx. glyphs . len ( ) == 1
9
10
&& self
10
11
. coverage ( )
11
- . map ( |cov| cov. get ( ctx . glyphs [ 0 ] . 0 . into ( ) ) . is_some ( ) )
12
+ . map ( |cov| cov. get ( gid ) . is_some ( ) )
12
13
. unwrap_or_default ( )
13
14
}
14
15
}
15
16
16
17
impl Apply for SingleSubstFormat1 < ' _ > {
17
18
fn apply ( & self , ctx : & mut hb_ot_apply_context_t ) -> Option < ( ) > {
18
- let glyph = ctx. buffer . cur ( 0 ) . as_skrifa_glyph ( ) ;
19
+ let glyph = ctx. buffer . cur ( 0 ) . as_skrifa_glyph16 ( ) ;
19
20
self . coverage ( ) . ok ( ) ?. get ( glyph) ?;
20
21
let subst = ( glyph. to_u16 ( ) as i32 + self . delta_glyph_id ( ) as i32 ) as u16 ;
21
22
ctx. replace_glyph ( GlyphId ( subst) ) ;
You can’t perform that action at this time.
0 commit comments