Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 62bfaf1c6d81535db742fef9f3cefea3825d8ac0 1 parent a4c1058
Yi Yang ahyangyi authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 fontforge/scstylesui.c
4 fontforge/scstylesui.c
View
@@ -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

Yi Yang
Collaborator

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.

Dave Crossland
Owner

Thanks for this @ahyangyi

Please sign in to comment.
Something went wrong with that request. Please try again.