Permalink
Browse files

Fix: "Change glyph" command would fail if the y mapping list was empty.

  • Loading branch information...
1 parent a4c1058 commit 62bfaf1c6d81535db742fef9f3cefea3825d8ac0 @ahyangyi ahyangyi committed Mar 8, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 fontforge/scstylesui.c
View
4 fontforge/scstylesui.c
@@ -825,8 +825,8 @@ static void MappingMatrixInit(struct matrixinit *mi,SplineFont *sf,
md[3*(i+j)+2].u.md_real = rint(scale*md[3*(i+j)+0].u.md_real);
}
} else if ( xheight==0 && capheight==0 ) {
- md = gcalloc(4,sizeof(struct matrix_data));
- mi->initial_row_cnt = 0;
+ md = gcalloc(3,sizeof(struct matrix_data));
+ mi->initial_row_cnt = 1;
mi->matrix_data = md;
} else {
cnt = 1; /* For the baseline */

2 comments on commit 62bfaf1

@ahyangyi

For those who doesn't understand what I was doing, here is some explanation:

md is an array of size 3 * mi->initial_row_cnt. 3 elements form a triplet (old_y, extent, new_y).

Therefore, when you have no information available, the sane choice is to put three zeros and let mi->initial_row_cnt to be one.

I really cannot figure out why it allocated 4 elements at all. And it didn't work.

@davelab6
fontforge member

Thanks for this @ahyangyi

Please sign in to comment.