static int gf_font_get_glyph(DviParams *params, DviFont *font, int code) { DviFontChar *ch; if(code < font->loc || code > font->hic || !font->chars) return -1; ch = &font->chars[code - font->loc]; if(!ch->loaded) { if(ch->offset == 0) return -1; DEBUG((DBG_GLYPHS, "(gf) %s: loading GF glyph for character %d\n", font->fontname, code)); if(font->in == NULL && font_reopen(font) < 0) return -1; if(fseek(font->in, ch->offset, SEEK_SET) == -1) return -1; if(gf_read_bitmap(font->in, ch) < 0) return -1; ch->loaded = 1; } return 0; }
/* used from context: params and device */ static int load_font_file(DviParams *params, DviFont *font) { int status; if(SEARCH_DONE(font->search)) return -1; if(font->in == NULL && font_reopen(font) < 0) return -1; DEBUG((DBG_FONTS, "%s: loading %s font from `%s'\n", font->fontname, font->finfo->name, font->filename)); do { status = font->finfo->load(params, font); } while(status < 0 && mdvi_font_retry(params, font) == 0); if(status < 0) return -1; if(font->in) { fclose(font->in); font->in = NULL; } DEBUG((DBG_FONTS, "reload_font(%s) -> %s\n", font->fontname, status < 0 ? "Error" : "Ok")); return 0; }