sumatrapdf icon indicating copy to clipboard operation
sumatrapdf copied to clipboard

Font decoding

Open sumsu opened this issue 2 years ago • 7 comments

In 3.5.2 and 3.6.15925 there is issue with font decoding. There are lost letters, wrong fonts: obraz obraz

It should look like this (screenshots from SumatraPDF 1.8): obraz obraz

sumsu avatar Dec 18 '23 08:12 sumsu

Can't do anything without a test PDF showing the problem

kjk avatar Feb 04 '24 12:02 kjk

I'll send you original pdf document by email. Subject of an email will be the same as this issue.

sumsu avatar Feb 08 '24 10:02 sumsu

Got the document, confirmed mis-renders. Same problem in mupdf 1.23.0

Probably related debug info:

ignoring CMap range (225-225) that is outside of the codespace
non-embedded font using identity encoding: Arial (mapping via )

So most likely broken document but renders in pdfium so should be recoverable.

kjk avatar Feb 08 '24 10:02 kjk

Making the following change:

diff --git a/mupdf/source/pdf/pdf-cmap.c b/mupdf/source/pdf/pdf-cmap.c
index d38f8cd10..c72545411 100644
--- a/mupdf/source/pdf/pdf-cmap.c
+++ b/mupdf/source/pdf/pdf-cmap.c
@@ -535,7 +535,7 @@ add_range(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high,
                if (!inrange)
                {
                        fz_warn(ctx, "ignoring CMap range (%u-%u) that is outside of the codespace", low, high);
-                       return;
+                       //return;
                }
        }

would show the polish letters but the font would still be wrong. This would not be the right fix.

This is beyond my understanding of what's wrong. Should be reported to mupdf https://bugs.ghostscript.com/

kjk avatar Feb 08 '24 10:02 kjk

I've checked this document with sumatra 1.8 and everything was OK.

sumsu avatar Feb 08 '24 10:02 sumsu