After distilling the attached test file with GS from CVS HEAD, the last page (page 5) has some strange elements by the text. This file works fine in 8.00, but starts to display this problem in 8.11.
Created attachment 281 [details] Illustrator5.zip
Created attachment 282 [details] Bug1344.ps This file also exhibits the same problem more clearly I believe.
Created attachment 285 [details] Bug1344-.ps Attaching a reduced test that reproduce the problem. It is made from Bug1344.ps by manual deletion of other texts. The problematic text is painted with a Type 3 font, which's CharProc uses another Type 3 font and a Type 1 font. Probably something is wrong with text matrices in this case. Colors are strange as well.
These files also causes (sometimes) crash on Windows. See stack dump below when interpreting Illustrator5.ps: gsdll32.dll!names_index_ref(const name_table_s * nt=0x017957f8, unsigned int index=24750624, ref_s * pnref=0x0012c5ec) Line 279 + 0x12 C gsdll32.dll!glyph_ref(unsigned long glyph=24750624, ref_s * gref=0x0012c5ec) Line 366 + 0x14 C gsdll32.dll!z1_glyph_info_generic(gs_font_s * font=0x02b9c478, unsigned long glyph=24750624, const gs_matrix_s * pmat=0x0012c820, int members=41, gs_glyph_info_s * info=0x0012c7ac, int (gs_font_s *, unsigned long, const gs_matrix_s *, int, gs_glyph_info_s *)* proc=0x024325f4, int wmode=0) Line 1134 + 0xd C gsdll32.dll!z1_glyph_info(gs_font_s * font=0x02b9c478, unsigned long glyph=24750624, const gs_matrix_s * pmat=0x0012c820, int members=41, gs_glyph_info_s * info=0x0012c7ac) Line 1201 + 0x22 C gsdll32.dll!compare_glyphs(const gs_font_s * cfont=0x02969518, const gs_font_s * ofont=0x02b9c478, unsigned long * glyphs=0x0012c91c, int num_glyphs=2, int level=1) Line 714 + 0x23 C gsdll32.dll!compare_glyphs(const gs_font_s * cfont=0x02969518, const gs_font_s * ofont=0x02b9c478, unsigned long * glyphs=0x0012cc24, int num_glyphs=1, int level=0) Line 749 + 0x1c C gsdll32.dll!gs_copied_can_copy_glyphs(const gs_font_s * cfont=0x02969518, const gs_font_s * ofont=0x02b9c478, unsigned long * glyphs=0x0012cc24, int num_glyphs=1, int check_hinting=1) Line 2089 + 0x17 C gsdll32.dll!pdf_find_font_resource(gx_device_pdf_s * pdev=0x020edba8, gs_font_s * font=0x02b9c478, int type=5, pdf_font_resource_s * * ppdfont=0x0012cf90, unsigned long * glyphs=0x0012cc24, unsigned long * chars=0x0012cc2c, int num_chars=1) Line 722 + 0x17 C gsdll32.dll!pdf_obtain_font_resource(const gs_text_enum_s * penum=0x02b9cf68, const gs_string_s * pstr=0x0012d004, pdf_font_resource_s * * ppdfont=0x0012cf90) Line 1154 + 0x33 C gsdll32.dll!pdf_encode_string(gx_device_pdf_s * pdev=0x020edba8, const pdf_text_enum_s * penum=0x02b9cf68, const gs_string_s * pstr=0x0012d004, pdf_font_resource_s * * ppdfont=0x0012cfc0) Line 141 + 0x11 C gsdll32.dll!pdf_encode_process_string(pdf_text_enum_s * penum=0x02b9cf68, gs_string_s * pstr=0x0012d004, const gs_matrix_s * pfmat=0x00000000, pdf_text_process_state_s * ppts=0x0012d010) Line 74 + 0x15 C gsdll32.dll!process_plain_text(gs_text_enum_s * pte=0x02b9cf68, void * vbuf=0x0012d088, unsigned int bsize=1) Line 970 + 0x13 C gsdll32.dll!pdf_text_process(gs_text_enum_s * pte=0x02b9cf68) Line 1698 + 0xf C gsdll32.dll!gs_text_process(gs_text_enum_s * pte=0x02b9cf68) Line 460 + 0xd C gsdll32.dll!op_show_continue_pop(gs_context_state_s * i_ctx_p=0x020c96a0, int npop=1) Line 456 + 0x12 C gsdll32.dll!zshow(gs_context_state_s * i_ctx_p=0x020c96a0) Line 62 + 0xb C gsdll32.dll!interp(gs_context_state_s * * pi_ctx_p=0x0270c41c, const ref_s * pref=0x0012d794, ref_s * perror_object=0x0270c3fc) Line 1122 + 0xa C gsdll32.dll!gs_call_interp(gs_context_state_s * * pi_ctx_p=0x0270c41c, ref_s * pref=0x0012d794, int user_errors=0, int * pexit_code=0x0012d7dc, ref_s * perror_object=0x0270c3fc) Line 487 + 0x11 C gsdll32.dll!gs_interpret(gs_context_state_s * * pi_ctx_p=0x0270c41c, ref_s * pref=0x0012d794, int user_errors=0, int * pexit_code=0x0012d7dc, ref_s * perror_object=0x0270c3fc) Line 446 + 0x19 C gsdll32.dll!gs_main_interpret(gs_main_instance_s * minst=0x0270c218, ref_s * pref=0x0012d794, int user_errors=0, int * pexit_code=0x0012d7dc, ref_s * perror_object=0x0270c3fc) Line 211 + 0x1f C gsdll32.dll!gs_main_run_string_continue(gs_main_instance_s * minst=0x0270c218, const char * str=0x0165cff8, unsigned int length=51200, int user_errors=0, int * pexit_code=0x0012d7dc, ref_s * perror_object=0x0270c3fc) Line 590 + 0x19 C gsdll32.dll!gsapi_run_string_continue(gs_main_instance_s * minst=0x0270c218, const char * str=0x0165cff8, unsigned int length=51200, int user_errors=0, int * pexit_code=0x0012d7dc) Line 175 + 0x22 C gsdll32.dll!gsdll_execute_cont(const char * str=0x0165cff8, int len=51200) Line 123 + 0x19 C ..... More application stack
The file Bug1344.ps has 3 problems : 1. Colors are not written to charproc which doesn't call setcachedevice[2]. It is fixed with the patch http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003604.html . 2. An indeterministic failure in PS interpreter with a random error code. Maybe it casues the crash mentioned by Erik Strik. Fixed with the patch http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003603.html . 3. Some characters are cut off. Probably it's a clipping problem with Type 3 fonts. The corresponding code fragment was written without a strong definition. To be analyzed. 4. The strange text elements appear due to hinting of 1-pixel font size, which appears during the Type 3 charproc accumulation. A suggested patch http://www.ghostscript.com/pipermail/gs-code-review/2003-September/004113.html is sent to code review, because I need an additional information about an old GS solution.
Dear Erik Strik, Please try patches mentioned in my previous followup. Possibly http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003603.html fixes the crash you mentioned. In future please don't put big logs into followups. Instead please put them as attachments. Thank you.
Testing with HEAD as of 9 AM PDT Sept 15, 2003 I still am able to reproduce the SEGV in names_index_ref. This occurs during the recursive call to compare_glyphs, where the 'pieces' array appears to have garbage in it.
Created attachment 287 [details] Stack after crash Dear Igor, Thank you for the quick fixes of my problems. The problem with the damaged characters has been solved. Unfortunately two problems remain: 1. The in http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003603.html mentioned fix in gsdps1.c does not fix my crash in "Illustrator5.ps". The mentioned fix, fixes a problem introduced after gs8_11. The crash I have is occuring in gs8_01, gs8_11 and CVS_HEAD. The crash occurs in compare_glyps, called by gs_copy_can_copy_glyphs with probably invalid values. 2. Some characters are missing from "Illustrator5.ps". In the last page (the Pantone plate) "0%" is missing twice. In the middle of the page it should show "40%" and "60%". The "4" and "6" where previously damaged (fixed now). The "0%" is missing. Maybe the missing "0%" is related to the crash. If you inspect the stack it shows invalid glyph indexes passed to compare_glyphs. Pleas bare in mind that this crash happens in 1 of 3 occasions and pdfwrite is called with our fixed set of parameters as seen in GSTest.exe Kind regards, Erik Strik
The problem with character cut off happens due to the font /|O_____Folio-Medium defines FontBBox [0 0 1 1] but the character 'p' has part outside [0 0 1 1]. With raster devices this isn't important because its charproc used setcharwidth, i.e. the raster isn't cached and isn't clipped. The pdfwrite's problem is that it always sets a clip in charproc. It is used to cancel the full page clip while entering the charproc accumulation (gdevpdtt.c ln 166). This code fragment to be rewrtitten without an artificial clip, rather the fix isn't obvious and isn't surely possible. Will try to fix it soon.
The patch http://www.ghostscript.com/pipermail/gs-code-review/2003- September/004113.html (the point '4' above) has been committed as http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003607.html Note the improved log message.
Patch http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003608.html fixes the problem (3).
I confirm the crash with Illustrator5.ps . The chash isn't deterministic. In the debugger session of Visual Sdudio 6 it happens with gswin32c.exe, but doesn't happen with gswin32.exe . Also setting -dCompatibilityLevel=1.3 avoids the crash (the latter must not be considered as a suggested workaround). However I don't confirm the problem with "40%" and "60%". With the current CVS HEAD (after the patch http://www.ghostscript.com/pipermail/gs-cvs/2003- September/003608.html) the text looks fine. BTW, I can see 62% rather than 60%, both with pdfwrite and display devices.
The patch http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003609.html fixes the crash with Illustrator5.ps .
The patch http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003610.html was committed by a mistake. It was replaced with a correct one http://www.ghostscript.com/pipermail/gs-cvs/2003-September/003611.html , which makes same changes with a different log message. Igor.