Bug 708042

Summary: CMap issue with LaTeX and ghostscript 10.04.0
Product: Ghostscript Reporter: bruno.n.pagani
Component: PDF WriterAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bruno.n.pagani, denis.bitouze
Priority: P2    
Version: 10.04.0   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: Original file
File processed with gs10.03.1
File processed with gs10.04.0

Description bruno.n.pagani 2024-09-19 12:08:46 UTC
Created attachment 26058 [details]
Original file

After updating ghostscript to 10.04.0, I have an issue that looks like https://bugs.ghostscript.com/show_bug.cgi?id=707831.

I am post-processing my (Lua)LaTeX outputs with

gs -o "outputgs.pdf" -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress output.pdf

With gs 10.03.1 I had no issue, but with gs 10.04.0 the processing returns:

The following errors were encountered at least once while processing this file:
	CMap unrecoverably broken

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> LuaTeX-1.18.0 <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

As a result, selecting or copying text from the file is broken.

For instance, here is the first title line, normally first and as it is now second:

1 Résolution analytique de la chute en régime turbulent

ࣝ XǑȕȂǶȟȜǦȂǼ ƷǼƷǶΝȜǦȑȟǐ njǐ ǶƷ džǣȟȜǐ ǐǼ ȒǑǝǦǻǐ ȜȟȒDžȟǶǐǼȜ
Comment 1 bruno.n.pagani 2024-09-19 12:09:25 UTC
Created attachment 26059 [details]
File processed with gs10.03.1
Comment 2 bruno.n.pagani 2024-09-19 12:09:45 UTC
Created attachment 26060 [details]
File processed with gs10.04.0
Comment 3 Ken Sharp 2024-09-19 16:27:49 UTC
The ToUnicode CMaps in the file are strange. Every one looks like this:

0 beginbfrange
endbfrange
44 beginbfchar
<0001> <0041>

That is they all start with an empty bfrange, which we reject. It is legal, however. Pointless, but legal, so this commit 	65f6ea3c1660ea05b6a575cbe738e66e54b9a497 relaxes the requirement.
Comment 4 bruno.n.pagani 2024-09-19 19:49:23 UTC
Can confirm this solves the issue, thanks for the quick fix!
Comment 5 Ken Sharp 2024-12-18 17:36:26 UTC
*** Bug 708201 has been marked as a duplicate of this bug. ***
Comment 6 Ken Sharp 2024-12-19 08:24:02 UTC
*** Bug 708201 has been marked as a duplicate of this bug. ***