コード例 #1
0
ファイル: iutil.c プロジェクト: MasterPlexus/vendor_goldenve
/* (This is a single-use procedure, for clearer code.) */
static bool
fid_eq(const gs_memory_t *mem, const gs_font *pfont1, const gs_font *pfont2)
{
    while (pfont1->base != pfont1)
	pfont1 = pfont1->base;
    while (pfont2->base != pfont2)
	pfont2 = pfont2->base;
    if (pfont1 == pfont2)
	return true;
    switch (pfont1->FontType) {
    case 1: case 3:
	if (pfont1->FontType == pfont2->FontType)
	    break;
    default:
	return false;
    }
    /* The following, while peculiar, appears to match CPSI. */
    {
	const gs_uid *puid1 = &((const gs_font_base *)pfont1)->UID;
	const gs_uid *puid2 = &((const gs_font_base *)pfont2)->UID;
    if (uid_is_UniqueID(puid1) || uid_is_UniqueID(puid2) ||
	((uid_is_XUID(puid1) || uid_is_XUID(puid2)) &&
	 !uid_equal(puid1, puid2)))
	return false;
    }
    {
	const font_data *pfd1 = (const font_data *)pfont1->client_data;
	const font_data *pfd2 = (const font_data *)pfont2->client_data;

	if (!(obj_eq(mem, &pfd1->BuildChar, &pfd2->BuildChar) &&
	      obj_eq(mem, &pfd1->BuildGlyph, &pfd2->BuildGlyph) &&
	      obj_eq(mem, &pfd1->Encoding, &pfd2->Encoding) &&
	      obj_eq(mem, &pfd1->CharStrings, &pfd2->CharStrings)))
	    return false;
	if (pfont1->FontType == 1) {
	    ref *ppd1, *ppd2;

	    if (dict_find_string(&pfd1->dict, "Private", &ppd1) > 0 &&
		dict_find_string(&pfd2->dict, "Private", &ppd2) > 0 &&
		!obj_eq(mem, ppd1, ppd2))
		return false;
	}
    }
    return true;	    
}
コード例 #2
0
/* Write a UniqueID and/or XUID. */
static void
write_uid(stream *s, const gs_uid *puid)
{
    if (uid_is_UniqueID(puid))
	pprintld1(s, "/UniqueID %ld def\n", puid->id);
    else if (uid_is_XUID(puid)) {
	uint i, n = uid_XUID_size(puid);

	stream_puts(s, "/XUID [");
	for (i = 0; i < n; ++i)
	    pprintld1(s, "%ld ", uid_XUID_values(puid)[i]);
	stream_puts(s, "] readonly def\n");
    }
}
コード例 #3
0
ファイル: zbfont.c プロジェクト: BorodaZizitopa/ghostscript
/* The caller guarantees that *op is a dictionary. */
int
build_gs_simple_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
                     font_type ftype, gs_memory_type_ptr_t pstype,
                     const build_proc_refs * pbuild,
                     build_font_options_t options)
{
    double bbox[4];
    gs_uid uid;
    int code;
    gs_font_base *pfont;
    uint space = ialloc_space(idmemory);

    code = font_bbox_param(imemory, op, bbox);
    if (code < 0)
        return code;
    /*
     * Make sure that we allocate uid
     * in the same VM as the font dictionary
     * (see build_gs_sub_font).
     */
    ialloc_set_space(idmemory, r_space(op));
    code = dict_uid_param(op, &uid, 0, imemory, i_ctx_p);
    ialloc_set_space(idmemory, space);
    if (code < 0)
        return code;
    if ((options & bf_UniqueID_ignored) && uid_is_UniqueID(&uid))
        uid_set_invalid(&uid);
    code = build_gs_font(i_ctx_p, op, (gs_font **) ppfont, ftype, pstype,
                         pbuild, options);
    if (code != 0)		/* invalid or scaled font */
        return code;
    pfont = *ppfont;
    pfont->procs.init_fstack = gs_default_init_fstack;
    pfont->procs.define_font = gs_no_define_font;
    pfont->procs.decode_glyph = gs_font_map_glyph_to_unicode;
    pfont->procs.make_font = zbase_make_font;
    pfont->procs.next_char_glyph = gs_default_next_char_glyph;
    pfont->FAPI = 0;
    pfont->FAPI_font_data = 0;
    init_gs_simple_font(pfont, bbox, &uid);
    lookup_gs_simple_font_encoding(pfont);
    get_GlyphNames2Unicode(i_ctx_p, (gs_font *)pfont, op);
    return 0;
}