예제 #1
0
파일: gf.c 프로젝트: 4eremuxa/evince
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;
}
예제 #2
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;
}