File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,10 @@ impl ParsedFont {
422
422
for gid in glyph_ids. keys ( ) {
423
423
let ( width, _) = match self . get_glyph_size ( * gid) {
424
424
Some ( s) => s,
425
- None => continue ,
425
+ None => match self . get_space_width ( ) {
426
+ Some ( w) => ( w as i32 , 0 ) ,
427
+ None => ( 0 , 0 ) ,
428
+ } ,
426
429
} ;
427
430
428
431
if * gid == current_high_gid {
@@ -764,7 +767,7 @@ impl ParsedFont {
764
767
// get the x and y size of a glyph (unscaled units)
765
768
pub fn get_glyph_size ( & self , glyph_index : u16 ) -> Option < ( i32 , i32 ) > {
766
769
let g = self . glyph_records_decoded . get ( & glyph_index) ?;
767
- let glyph_width = g. bounding_box . max_x as i32 - g . bounding_box . min_x as i32 ; // width
770
+ let glyph_width = g. horz_advance as i32 ;
768
771
let glyph_height = g. bounding_box . max_y as i32 - g. bounding_box . min_y as i32 ; // height
769
772
Some ( ( glyph_width, glyph_height) )
770
773
}
You can’t perform that action at this time.
0 commit comments