Mercurial > MadButterfly
comparison src/shape_stext.c @ 446:2437047b8bb8
Fix bug of propertional shifting of sh_stext_t.
Original
- sh_stext_t does not apply shifting of text himself to scaled font face, but
- apply aggreagated matrix to font face.
- shifting in parent parent coord_t would applied to scaled font.
- amount of shifting is also multiplied by aggreagated matrix.
- It means shiftings of parent coord_ts are applied two times.
Now,
- remove x, y shifting from aggreagated matrices before applying
to scaled fonts.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 02 Aug 2009 10:59:59 +0800 |
parents | e73b3644d802 |
children | 38aae921243f |
comparison
equal
deleted
inserted
replaced
445:cb1a65d53878 | 446:2437047b8bb8 |
---|---|
452 mb_font_face_t *face, | 452 mb_font_face_t *face, |
453 co_aix shift_x, co_aix shift_y, | 453 co_aix shift_x, co_aix shift_y, |
454 co_aix font_sz) { | 454 co_aix font_sz) { |
455 co_aix matrix[6], scaled_matrix[6]; | 455 co_aix matrix[6], scaled_matrix[6]; |
456 co_aix *aggr; | 456 co_aix *aggr; |
457 co_aix noshift_aggr[6]; | |
457 mb_scaled_font_t *scaled; | 458 mb_scaled_font_t *scaled; |
458 | 459 |
459 aggr = sh_get_aggr_matrix((shape_t *)txt_o); | 460 aggr = sh_get_aggr_matrix((shape_t *)txt_o); |
461 memcpy(noshift_aggr, aggr, sizeof(co_aix) * 6); | |
462 noshift_aggr[2] = 0; | |
463 noshift_aggr[5] = 0; | |
464 | |
460 matrix[0] = font_sz; | 465 matrix[0] = font_sz; |
461 matrix[1] = 0; | 466 matrix[1] = 0; |
462 matrix[2] = shift_x; | 467 matrix[2] = shift_x; |
463 matrix[3] = 0; | 468 matrix[3] = 0; |
464 matrix[4] = font_sz; | 469 matrix[4] = font_sz; |
465 matrix[5] += shift_y; | 470 matrix[5] += shift_y; |
466 matrix_mul(aggr, matrix, scaled_matrix); | 471 matrix_mul(noshift_aggr, matrix, scaled_matrix); |
467 | 472 |
468 scaled = make_scaled_font_face_matrix(face, scaled_matrix); | 473 scaled = make_scaled_font_face_matrix(face, scaled_matrix); |
469 | 474 |
470 return scaled; | 475 return scaled; |
471 } | 476 } |