transformedfont_t*f = rfx_calloc(sizeof(transformedfont_t));
f->orig = orig;
f->matrix = *m;
- f->used = malloc(sizeof(f->used[0])*orig->num_glyphs);
+ f->used = rfx_calloc(sizeof(f->used[0])*orig->num_glyphs);
+ int t;
+ for(t=0;t<orig->num_glyphs;t++) {
+ if(orig->glyphs[t].unicode==32)
+ f->used[t]=1; //always preserve the space char in fonts
+ }
return f;
}
{
internal_t*i = (internal_t*)f->internal;
mymatrix_t m;
- matrix_convert(matrix, font->id, &m, 0);
+ if(!font->id)
+ msg("<error> Font has no ID");
+ matrix_convert(matrix, font->id?font->id:"unknown", &m, 0);
transformedfont_t*fd = dict_lookup(i->matrices, &m);
if(!fd) {
fd = transformedfont_new(font, &m);
fd->dx = -total.xmin;
font->ascent = total.ymax;
- font->descent = total.ymin;
+ font->descent = -total.ymin;
for(t=0;t<count;t++) {
gfxline_t*line = font->glyphs[t].line;
mymatrix_t m;
gfxmatrix_t scalematrix;
- matrix_convert(matrix, font->id, &m, &scalematrix);
+ matrix_convert(matrix, font->id?font->id:"unknown", &m, &scalematrix);
transformedfont_t*d = dict_lookup(i->matrices, &m);
scalematrix.tx -= d->dx*scalematrix.m00;
out->drawchar(out, d->font, d->used[glyphnr], color, &scalematrix);