From 94d070553225e0a8fb38157e081e9496dee8fde5 Mon Sep 17 00:00:00 2001 From: Ken Sharp Date: Wed, 12 Mar 2014 15:52:34 +0000 Subject: pdfwrite - remove deprecated code Before the release of 9.06 I #ifdef'ed a load of code as deprecated. Nobody has found any problems, so I'm removing the code. --- gs/devices/vector/gdevpdf.c | 48 --------------------------------------- gs/devices/vector/gdevpdfb.h | 3 --- gs/devices/vector/gdevpdfp.c | 3 --- gs/devices/vector/gdevpdfu.c | 26 --------------------- gs/devices/vector/gdevpdfx.h | 17 -------------- gs/devices/vector/gdevpdt.h | 8 ------- gs/devices/vector/gdevpdte.c | 30 ------------------------ gs/devices/vector/gdevpdtf.h | 8 ------- gs/devices/vector/gdevpdtt.c | 26 --------------------- gs/devices/vector/gdevpdtw.c | 47 -------------------------------------- gs/devices/vector/gdevpsds.c | 54 -------------------------------------------- 11 files changed, 270 deletions(-) diff --git a/gs/devices/vector/gdevpdf.c b/gs/devices/vector/gdevpdf.c index 92dcc7dda..0fb067ebe 100644 --- a/gs/devices/vector/gdevpdf.c +++ b/gs/devices/vector/gdevpdf.c @@ -366,9 +366,6 @@ pdf_compute_fileID(gx_device_pdf * pdev) return code; sclose(s); gs_free_object(mem, s, "pdf_compute_fileID"); -#ifdef DEPRECATED_906 - memcpy(pdev->fileID, "xxxxxxxxxxxxxxxx", sizeof(pdev->fileID)); /* Debug */ -#endif return 0; } @@ -800,16 +797,6 @@ pdf_print_orientation(gx_device_pdf * pdev, pdf_page_t *page) (page != NULL ? &page->text_rotation : &pdev->text_rotation); int angle = -1; -#ifdef DEPRECATED_906 - /* Bug 687800 together with Bug687489.ps . */ - const gs_point *pbox = &(page != NULL ? page : &pdev->pages[0])->MediaBox; - - if (dsc_orientation >= 0 && pbox->x > pbox->y) { - /* The page is in landscape format. Adjust the rotation accordingly. */ - dsc_orientation ^= 1; - } -#endif - /* Combine DSC rotation with text rotation : */ if (dsc_orientation == 0) { if (ptr->Rotate == 0 || ptr->Rotate == 180) @@ -896,32 +883,6 @@ pdf_close_page(gx_device_pdf * pdev, int num_copies) if (code < 0) return code; - /* Save viewer's memory with cleaning resources. */ - -#ifdef DEPRECATED_906 - if (pdev->MaxViewerMemorySize < 10000000) { - /* fixme: the condition above and the cleaning algorithm - may be improved with counting stored resource size - and creating multiple streams per page. */ - - if (pdev->ForOPDFRead) { - pdf_resource_t *pres = pdf_find_resource_by_resource_id(pdev, resourcePage, pdev->contents_id); - - if (pres != NULL) { - code = cos_dict_put_c_strings((cos_dict_t *)pres->object, "/.CleanResources", "/All"); - if (code < 0) - return code; - } - } - code = pdf_close_text_document(pdev); - if (code < 0) - return code; - code = pdf_write_and_free_all_resource_objects(pdev); - if (code < 0) - return code; - } -#endif - /* Close use of text on the page. */ pdf_close_text_page(pdev); @@ -2330,11 +2291,6 @@ pdf_close(gx_device * dev) code1 = pdf_free_resource_objects(pdev, resourceSoftMaskDict); if (code >= 0) code = code1; -#ifdef DEPRECATED_906 - code1 = pdf_close_text_document(pdev); - if (code >= 0) - code = code1; -#endif /* This was in pdf_close_document, but that made no sense, so moved here * for more consistency (and ease of finding it). This code deals with * emitting fonts and FontDescriptors @@ -3041,10 +2997,6 @@ pdf_close(gx_device * dev) emprintf2(pdev->memory, "ERROR: A pdfmark destination page %d " "points beyond the last page %d.\n", pdev->max_referred_page, pdev->next_page); -#ifdef DEPRECATED_906 /* Temporary disabled due to Bug 687686. */ - if (code >= 0) - code = gs_note_error(gs_error_rangecheck); -#endif } code = pdf_close_files(pdev, code); if (code < 0) diff --git a/gs/devices/vector/gdevpdfb.h b/gs/devices/vector/gdevpdfb.h index 799bc2d3e..34935fffb 100644 --- a/gs/devices/vector/gdevpdfb.h +++ b/gs/devices/vector/gdevpdfb.h @@ -137,9 +137,6 @@ const gx_device_pdf PDF_DEVICE_IDENT = 0 /*false*/, /* PDFA */ 0 /*false*/, /* Abort generation of PDFA or X, produce PDF */ 12000, /* MaxClipPathSize */ /* HP LaserJet 1320 hangs with 14000. */ -#ifdef DEPRECATED_906 - max_long, /* MaxViewerMemorySize */ -#endif 256000, /* MaxShadingBitmapSize */ PDF_DEVICE_MaxInlineImageSize, /* MaxInlineImageSize */ {0, 0}, /* DSCEncodingToUnicode */ diff --git a/gs/devices/vector/gdevpdfp.c b/gs/devices/vector/gdevpdfp.c index a1416dd5e..75641cfda 100644 --- a/gs/devices/vector/gdevpdfp.c +++ b/gs/devices/vector/gdevpdfp.c @@ -91,9 +91,6 @@ static const gs_param_item_t pdf_param_items[] = { pi("PatternImagemask", gs_param_type_bool, PatternImagemask), pi("MaxClipPathSize", gs_param_type_int, MaxClipPathSize), pi("MaxShadingBitmapSize", gs_param_type_int, MaxShadingBitmapSize), -#ifdef DEPRECATED_906 - pi("MaxViewerMemorySize", gs_param_type_int, MaxViewerMemorySize), -#endif pi("HaveTrueTypes", gs_param_type_bool, HaveTrueTypes), pi("HaveCIDSystem", gs_param_type_bool, HaveCIDSystem), pi("HaveTransparency", gs_param_type_bool, HaveTransparency), diff --git a/gs/devices/vector/gdevpdfu.c b/gs/devices/vector/gdevpdfu.c index 05895fc3e..4a6d27e73 100644 --- a/gs/devices/vector/gdevpdfu.c +++ b/gs/devices/vector/gdevpdfu.c @@ -1608,32 +1608,6 @@ pdf_free_resource_objects(gx_device_pdf *pdev, pdf_resource_type_t rtype) return 0; } -#ifdef DEPRECATED_906 -/* Write and free all resource objects. */ - -int -pdf_write_and_free_all_resource_objects(gx_device_pdf *pdev) -{ - int i, code = 0, code1; - - for (i = 0; i < NUM_RESOURCE_TYPES; ++i) { - code1 = pdf_write_resource_objects(pdev, i); - if (code >= 0) - code = code1; - } - code1 = pdf_finish_resources(pdev, resourceFontDescriptor, - pdf_release_FontDescriptor_components); - if (code >= 0) - code = code1; - for (i = 0; i < NUM_RESOURCE_TYPES; ++i) { - code1 = pdf_free_resource_objects(pdev, i); - if (code >= 0) - code = code1; - } - return code; -} -#endif - /* * Store the resource sets for a content stream (page or XObject). * Sets page->{procsets, resource_ids[]}. diff --git a/gs/devices/vector/gdevpdfx.h b/gs/devices/vector/gdevpdfx.h index df73ab137..be010a261 100644 --- a/gs/devices/vector/gdevpdfx.h +++ b/gs/devices/vector/gdevpdfx.h @@ -593,9 +593,6 @@ struct gx_device_pdf_s { bool AbortPDFAX; /* Abort generation of PDFA or X, produce regular PDF */ long MaxClipPathSize; /* The maximal number of elements of a clipping path that the target viewer|printer can handle. */ -#ifdef DEPRECATED_906 - long MaxViewerMemorySize; -#endif long MaxShadingBitmapSize; /* The maximal number of bytes in a bitmap representation of a shading. (Bigger shadings to be downsampled). */ @@ -1110,12 +1107,6 @@ void pdf_reverse_resource_chain(gx_device_pdf *pdev, pdf_resource_type_t rtype); */ int pdf_free_resource_objects(gx_device_pdf *pdev, pdf_resource_type_t rtype); -#ifdef DEPRECATED_906 -/* Write and free all resource objects. */ - -int pdf_write_and_free_all_resource_objects(gx_device_pdf *pdev); -#endif - /* * Store the resource sets for a content stream (page or XObject). * Sets page->{procsets, resource_ids[], fonts_id}. @@ -1419,14 +1410,6 @@ int pdf_replace_names(gx_device_pdf *pdev, const gs_param_string *from, /* For gdevpdf.c */ -#ifdef DEPRECATED_906 -/* - * Close the text-related parts of a document, including writing out font - * and related resources. - */ -int pdf_close_text_document(gx_device_pdf *pdev); -#endif - int write_font_resources(gx_device_pdf *pdev, pdf_resource_list_t *prlist); /* ---------------- Exported by gdevpdft.c ---------------- */ diff --git a/gs/devices/vector/gdevpdt.h b/gs/devices/vector/gdevpdt.h index 6a5c0de4e..8694e36d3 100644 --- a/gs/devices/vector/gdevpdt.h +++ b/gs/devices/vector/gdevpdt.h @@ -61,14 +61,6 @@ void pdf_reset_text_state(pdf_text_data_t *ptd); /* gdevpdts.h */ */ void pdf_close_text_page(gx_device_pdf *pdev); /* gdevpdti.h */ -#ifdef DEPRECATED_906 -/* - * Close the text-related parts of a document, including writing out font - * and related resources. - */ -int pdf_close_text_document(gx_device_pdf *pdev); /* gdevpdtw.h */ -#endif - /* ---------------- Contents state (for gdevpdfu.c) ---------------- */ /* diff --git a/gs/devices/vector/gdevpdte.c b/gs/devices/vector/gdevpdte.c index c40fd4f62..21e2ad665 100644 --- a/gs/devices/vector/gdevpdte.c +++ b/gs/devices/vector/gdevpdte.c @@ -124,18 +124,12 @@ pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfon key_size = 2; } else if (font->FontType == ft_CID_TrueType || font->FontType == ft_composite) { key_size = 2; -#ifdef DEPRECATED_906 - gs_font_cid2 *pfcid = (gs_font_cid2 *)font; - - num_codes = pfcid->cidata.common.CIDCount; -#else /* Since PScript5.dll creates GlyphNames2Unicode with character codes instead CIDs, and with the WinCharSetFFFF-H2 CMap character codes appears from the range 0-0xFFFF (Bug 687954), we must use the maximal character code value for the ToUnicode code count. */ num_codes = 65536; -#endif } code = gs_cmap_ToUnicode_alloc(pdev->pdf_memory, pdfont->rid, num_codes, key_size, &pdfont->cmap_ToUnicode); @@ -1041,30 +1035,6 @@ process_text_return_width(const pdf_text_enum_t *pte, gs_font_base *font, return widths_differ; } -#ifdef DEPRECATED_906 -/* - * Retrieve glyph origing shift for WMode = 1 in design units. - */ -static void -pdf_glyph_origin(pdf_font_resource_t *pdfont, int ch, int WMode, gs_point *p) -{ - /* For CID fonts PDF viewers provide glyph origin shift automatically. - * Therefore we only need to do for non-CID fonts. - */ - switch (pdfont->FontType) { - case ft_encrypted: - case ft_encrypted2: - case ft_TrueType: - case ft_user_defined: - *p = pdfont->u.simple.v[ch]; - break; - default: - p->x = p->y = 0; - break; - } -} -#endif - /* * Emulate TEXT_ADD_TO_ALL_WIDTHS and/or TEXT_ADD_TO_SPACE_WIDTH, * and implement TEXT_REPLACE_WIDTHS if requested. diff --git a/gs/devices/vector/gdevpdtf.h b/gs/devices/vector/gdevpdtf.h index cb0d5576c..89de1afca 100644 --- a/gs/devices/vector/gdevpdtf.h +++ b/gs/devices/vector/gdevpdtf.h @@ -424,14 +424,6 @@ pdf_font_embed_t pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font, */ int pdf_compute_BaseFont(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, bool finish); -#ifdef DEPRECATED_906 -/* - * Close the text-related parts of a document, including writing out font - * and related resources. - */ -int pdf_close_text_document(gx_device_pdf *pdev); /* in gdevpdtw.c */ -#endif - /* * Convert True Type fonts into CID fonts for PDF/A. */ diff --git a/gs/devices/vector/gdevpdtt.c b/gs/devices/vector/gdevpdtt.c index a1e947d86..b3eb0c874 100644 --- a/gs/devices/vector/gdevpdtt.c +++ b/gs/devices/vector/gdevpdtt.c @@ -661,28 +661,7 @@ private_st_pdf_font_cache_elem(); static ulong pdf_font_cache_elem_id(gs_font *font) { -#ifdef DEPRECATED_906 - /* - * For compatibility with Ghostscript rasterizer's - * cache logic we use UniqueID to identify fonts. - * Note that with buggy documents, which don't - * undefine UniqueID redefining a font, - * Ghostscript PS interpreter can occasionaly - * replace cache elements on insufficient cache size, - * taking glyphs from random fonts with random metrics, - * therefore the compatibility isn't complete. - */ - /* - * This branch is incompatible with pdf_notify_remove_font. - */ - if (font->FontType == ft_composite || font->PaintType != 0 || - !uid_is_valid(&(((gs_font_base *)font)->UID))) - return font->id; - else - return ((gs_font_base *)font)->UID.id; -#else return font->id; -#endif } pdf_font_cache_elem_t ** @@ -2667,13 +2646,8 @@ pdf_glyph_widths(pdf_font_resource_t *pdfont, int wmode, gs_glyph glyph, } } pwidths->Width.v = v; -#ifdef DEPRECATED_906 - if (code > 0) - pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0; -#else /* Skip only if not paralel to the axis. */ if (code > 0 && !pdf_is_CID_font(ofont)) pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0; -#endif if (cdevproc_result == NULL) { info.members = 0; code = ofont->procs.glyph_info(ofont, glyph, NULL, diff --git a/gs/devices/vector/gdevpdtw.c b/gs/devices/vector/gdevpdtw.c index 4ef1ec627..e7f64a4c3 100644 --- a/gs/devices/vector/gdevpdtw.c +++ b/gs/devices/vector/gdevpdtw.c @@ -684,53 +684,6 @@ pdf_finish_resources(gx_device_pdf *pdev, pdf_resource_type_t type, return 0; } -#ifdef DEPRECATED_906 -int -pdf_close_text_document(gx_device_pdf *pdev) -{ - int code; - - /* - * Finish the descriptors and write any embedded fonts, but don't - * write the descriptors yet; then write the fonts; finally write - * the descriptors. - */ - - pdf_clean_standard_fonts(pdev); - code = pdf_free_font_cache(pdev); - if (code < 0) - return code; - - code = pdf_write_resource_objects(pdev, resourceCharProc); - if (code < 0) - return code; - - code = pdf_finish_resources(pdev, resourceFont, pdf_convert_truetype_font); - if (code < 0) - return code; - - code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_finish_FontDescriptor); - if (code < 0) - return code; - - code = write_font_resources(pdev, &pdev->resources[resourceCIDFont]); - if (code < 0) - return code; - - code = write_font_resources(pdev, &pdev->resources[resourceFont]); - if (code < 0) - return code; - - code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_write_FontDescriptor); - if (code < 0) - return code; - - /* If required, write the Encoding for Type 3 bitmap fonts. */ - - return pdf_write_bitmap_fonts_Encoding(pdev); -} -#endif - /* ================ CMap resource writing ================ */ /* diff --git a/gs/devices/vector/gdevpsds.c b/gs/devices/vector/gdevpsds.c index 3c88ffc5e..5292cdf81 100644 --- a/gs/devices/vector/gdevpsds.c +++ b/gs/devices/vector/gdevpsds.c @@ -551,60 +551,6 @@ const stream_template s_IE_template = { 0 /* NULL */, s_IE_set_defaults }; -#ifdef DEPRECATED_906 - -/* Test code */ -void -test_IE(void) -{ - const stream_templat *const template = &s_IE_template; - stream_IE_state state; - stream_state *const ss = (stream_state *)&state; - static const float decode[6] = {1, 0, 1, 0, 1, 0}; - static const byte in[] = { - /* - * Each row is 3 pixels x 3 components x 4 bits. Processing the - * first two rows doesn't cause an error; processing all 3 rows - * does. - */ - 0x12, 0x35, 0x67, 0x9a, 0xb0, - 0x56, 0x7d, 0xef, 0x12, 0x30, - 0x88, 0x88, 0x88, 0x88, 0x80 - }; - byte table[3 * 5]; - int n; - - templat->set_defaults(ss); - state.BitsPerComponent = 4; - state.NumComponents = 3; - state.Width = 3; - state.BitsPerIndex = 2; - state.Decode = decode; - gs_bytestring_from_bytes(&state.Table, table, 0, sizeof(table)); - for (n = 10; n <= 15; n += 5) { - stream_cursor_read r; - stream_cursor_write w; - byte out[100]; - int status; - - s_IE_init(ss); - r.ptr = in; --r.ptr; - r.limit = r.ptr + n; - w.ptr = out; --w.ptr; - w.limit = w.ptr + sizeof(out); - memset(table, 0xcc, sizeof(table)); - memset(out, 0xff, sizeof(out)); - dmprintf1(ss->memory, "processing %d bytes\n", n); - status = templat->process(ss, &r, &w, true); - dmprintf3(ss->memory, "%d bytes read, %d bytes written, status = %d\n", - (int)(r.ptr + 1 - in), (int)(w.ptr + 1 - out), status); - debug_dump_bytes(ss->memory, table, table + sizeof(table), "table"); - debug_dump_bytes(ss->memory, out, w.ptr + 1, "out"); - } -} - -#endif - /* ---------------- Downsampling ---------------- */ /* Return the number of samples after downsampling. */ -- cgit v1.2.1