/* Build a type 2 (compact Adobe encrypted) font. */ static int zbuildfont2(i_ctx_t *i_ctx_p) { os_ptr op = osp; charstring_font_refs_t refs; build_proc_refs build; int code = build_proc_name_refs(imemory, &build, "%Type2BuildChar", "%Type2BuildGlyph"); gs_type1_data data1; if (code < 0) return code; code = charstring_font_get_refs(op, &refs); if (code < 0) return code; code = type2_font_params(op, &refs, &data1); if (code < 0) return code; return build_charstring_font(i_ctx_p, op, &build, ft_encrypted2, &refs, &data1, bf_notdef_required); }
/* Get one element of a FDArray. */ static int fd_array_element(i_ctx_t *i_ctx_p, gs_font_type1 **ppfont, ref *prfd) { charstring_font_refs_t refs; gs_type1_data data1; build_proc_refs build; gs_font_base *pbfont; gs_font_type1 *pfont; /* * Standard CIDFontType 0 fonts have Type 1 fonts in the FDArray, but * CFF CIDFontType 0 fonts have Type 2 fonts there. */ int fonttype = 1; /* default */ int code = charstring_font_get_refs(prfd, &refs); if (code < 0 || (code = dict_int_param(prfd, "FontType", 1, 2, 1, &fonttype)) < 0 ) return code; /* * We don't handle the alternate Subr representation (SubrCount, * SDBytes, SubrMapOffset) here: currently that is handled in * PostScript code (lib/gs_cidfn.ps). */ switch (fonttype) { case 1: data1.interpret = gs_type1_interpret; data1.subroutineNumberBias = 0; data1.lenIV = DEFAULT_LENIV_1; code = charstring_font_params(imemory, prfd, &refs, &data1); if (code < 0) return code; code = build_proc_name_refs(imemory, &build, "%Type1BuildChar", "%Type1BuildGlyph"); break; case 2: code = type2_font_params(prfd, &refs, &data1); if (code < 0) return code; code = charstring_font_params(imemory, prfd, &refs, &data1); if (code < 0) return code; code = build_proc_name_refs(imemory, &build, "%Type2BuildChar", "%Type2BuildGlyph"); break; default: /* can't happen */ return_error(e_Fatal); } if (code < 0) return code; code = build_gs_FDArray_font(i_ctx_p, prfd, &pbfont, fonttype, &st_gs_font_type1, &build); if (code < 0) return code; pfont = (gs_font_type1 *)pbfont; pbfont->FAPI = NULL; pbfont->FAPI_font_data = NULL; charstring_font_init(pfont, &refs, &data1); pfont->data.procs.glyph_data = z9_FDArray_glyph_data; pfont->data.procs.seac_data = z9_FDArray_seac_data; *ppfont = pfont; return 0; }