Bug 699964

Summary: Fonts missing in PDFs generated with XeLaTeX
Product: MuPDF Reporter: rnhmjoj <rnhmjoj>
Component: mupdfAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: major CC: tor.andersson
Priority: P4    
Version: 1.13.x   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description rnhmjoj 2018-10-14 15:34:05 UTC
I'm a user of the zathura document reader, which uses MuPDF internally to display PDFs. I'm reporting this issue here because it's not specific to zathura and I can reproduce it with mupdf-gl directly.

So MuPDF doesn't display text in PDFs generated with XeLaTeX: the layout and images are displayed correctly but all text is missing and empty space is shown instead. Both zathura and mupdf-gl also produce a stream consisting of the same error repeated over and over while scrolling the document:
```
error: name too long
warning: cannot draw text since font and size not set
warning: ... repeated 2 times ...
```

You can find a document to reproduce the bug here:
https://github.com/rnhmjoj/category-theory-for-programmers/releases

Related issues in other trackers:

  * https://github.com/NixOS/nixpkgs/issues/24485#issuecomment-407222313
  * https://bugs.pwmt.org/project/zathura/issue/756
Comment 1 Tor Andersson 2018-10-15 10:41:19 UTC
This file works in the current release. We have added workarounds to ignore and keep processing when encountering this category of syntax error.

The problem is with the syntax of the embedded ToUnicode CMap streams,
which have CMapNames which exceed the allowed length for name tokens.
For example, see object 2272 in the https://github.com/rnhmjoj/category-theory-for-programmers/releases/download/v0.4.0/category-theory-for-programmers.pdf file:

/CMapName /-nix-store-530m8pgwkjzw1h7w04n8nhjvzgqsl3j9-texlive-combined-2016-share-texmf-fonts-opentype-public-lm-lmroman12-bold.otf,000-UTF16 def

The name length is not supposed to exceed 127 bytes.
Comment 2 Tor Andersson 2018-10-15 11:32:22 UTC
Fixed in commit 1f279100b292519fa095c576e49ba3e3bb4efbe8
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Wed Aug 22 11:59:29 2018 +0200

    Truncate name tokens that are too long.