void pdf__end_glyph(PDF *p) { pdf_t3font *t3font = p->fonts[p->t3slot].t3font; pdf_t3glyph *glyph = &t3font->glyphs[t3font->curr_glyph]; int ig = t3font->curr_glyph; if (t3font->pass != 1 && glyph->charproc_id != PDC_BAD_ID) { /* check whether pdf__save() and pdf__restore() calls are balanced */ if (p->curr_ppt->sl > 0) pdc_error(p->pdc, PDF_E_GSTATE_UNMATCHEDSAVE, 0, 0, 0, 0); pdf_end_text(p); pdc_end_pdfstream(p->out); /* glyph description stream */ pdc_end_obj(p->out); /* glyph description */ pdc_put_pdfstreamlength(p->out, p->length_id); } PDF_SET_STATE(p, pdf_state_font); pdc_logg_cond(p->pdc, 1, trc_font, "\tEnd of Type3 font glyph \"%s\"\n", t3font->glyphs[ig].name); if (!p->pdc->smokerun) pdc_logg_cond(p->pdc, 1, trc_api, "[End glyph %d]\n", ig); }
void pdf__end_glyph(PDF *p) { PDF_SET_STATE(p, pdf_state_font); /* check whether pdf__save() and pdf__restore() calls are balanced */ if (p->sl > 0) pdc_error(p->pdc, PDF_E_GSTATE_UNMATCHEDSAVE, 0, 0, 0, 0); pdf_end_text(p); p->contents = c_none; pdc_end_pdfstream(p->out); /* glyph description stream */ pdc_end_obj(p->out); /* glyph description */ pdc_put_pdfstreamlength(p->out, p->length_id); }
/* Finish the pattern definition. */ void pdf__end_pattern(PDF *p) { /* check whether pdf__save() and pdf__restore() calls are balanced */ if (p->curr_ppt->sl > 0) pdc_error(p->pdc, PDF_E_GSTATE_UNMATCHEDSAVE, 0, 0, 0, 0); pdf_end_text(p); pdc_end_pdfstream(p->out); pdc_end_obj(p->out); /* pattern */ pdc_put_pdfstreamlength(p->out, p->length_id); pdc_begin_obj(p->out, p->res_id); /* Resource object */ pdc_begin_dict(p->out); /* Resource dict */ pdf_write_page_fonts(p); /* Font resources */ pdf_write_page_colorspaces(p); /* Color space resources */ pdf_write_page_pattern(p); /* Pattern resources */ pdf_write_xobjects(p); /* XObject resources */ pdf_write_page_extgstates(p); /* ExtGState resources */ pdc_end_dict(p->out); /* resource dict */ pdc_end_obj(p->out); /* resource object */ pdf_pg_resume(p, -1); if (p->flush & pdc_flush_content) pdc_flush_stream(p->out); if (!p->pdc->smokerun) pdc_logg_cond(p->pdc, 1, trc_api, "[End pattern %d]\n", p->pattern_number -1); }
/* copy the complete contents of src to a stream */ void pdf_copy_stream(PDF *p, PDF_data_source *src, pdc_bool compress) { int oldcompresslevel = pdc_get_compresslevel(p->out); if (!compress) pdc_set_compresslevel(p->out, 0); if (src->init) src->init(p, src); pdc_begin_pdfstream(p->out); while (src->fill(p, src)) pdc_write(p->out, src->next_byte, src->bytes_available); pdc_end_pdfstream(p->out); if (src->terminate) src->terminate(p, src); if (!compress) pdc_set_compresslevel(p->out, oldcompresslevel); }