-
- /* adjust the origin so that every character is to the
- right of the origin */
- gfxbbox_t total = {0,0,0,0};
- double average_xmax = 0;
- for(t=0;t<count;t++) {
- gfxline_t*line = font->glyphs[t].line;
- gfxbbox_t b = gfxline_getbbox(line);
- total = gfxbbox_expand_to_bbox(total, b);
- }
- if(count)
- average_xmax /= count;
-
- font->ascent = total.ymax;
- font->descent = -total.ymin;
-
- if(!fd->matrix.alpha) {
- /* for OCR: remove the outlines of characters that are only
- ever displayed with alpha=0 */
- for(t=0;t<count;t++) {
- gfxglyph_t*g = &font->glyphs[t];
- gfxline_free(g->line);
- g->line = (gfxline_t*)rfx_calloc(sizeof(gfxline_t));
- g->line->type = gfx_moveTo;
- g->line->x = g->advance;
- }
- }
-
- if(fd->matrix.m00>0) {
- /* subset kerning table */
- count = 0;
- for(t=0;t<fd->orig->kerning_size;t++) {
- int char1 = fd->used[fd->orig->kerning[t].c1]-1;
- int char2 = fd->used[fd->orig->kerning[t].c2]-1;
- if(char1>=0 && char2>=0) {
- count++;
- }
- }
- font->kerning = malloc(sizeof(font->kerning[0])*count);
- font->kerning_size = count;
- count = 0;
- for(t=0;t<fd->orig->kerning_size;t++) {
- int char1 = fd->used[fd->orig->kerning[t].c1]-1;
- int char2 = fd->used[fd->orig->kerning[t].c2]-1;
- if(char1>=0 && char2>=0) {
- font->kerning[count].c1 = char1;
- font->kerning[count].c2 = char2;
- font->kerning[count].advance = fd->orig->kerning[t].advance * fd->matrix.m00;
- count++;
- }
+ font->kerning = malloc(sizeof(font->kerning[0])*count);
+ font->kerning_size = count;
+ count = 0;
+ for(t=0;t<fd->orig->kerning_size;t++) {
+ int char1 = fd->used[fd->orig->kerning[t].c1]-1;
+ int char2 = fd->used[fd->orig->kerning[t].c2]-1;
+ if(char1>=0 && char2>=0) {
+ font->kerning[count].c1 = char1;
+ font->kerning[count].c2 = char2;
+ font->kerning[count].advance = fd->orig->kerning[t].advance * fd->matrix.m00;
+ count++;