pdfTeX bitmap (Type3) fonts are decoded as Zapf Dingbats: "Docling parses" becomes "❉♦❝❧✐♥❣ ♣❛a114a115❡a115"

Open
#473 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start by reading the Type3 font encoding logic and the glyph tables, especially glyphs/standard/zapfdingbats.dat; the issue describes how /Differences names such as /a76 are interpreted. Compare the existing whole-vector check for G<decimal> names with pdfTeX’s /a<decimal> convention, then run the proposed failing unit test. Done means Type3 pdfTeX bitmap fonts extract the original text while Zapf Dingbats fonts keep their glyph mapping.

Written by the indexing model from the issue text.

Description

When pdfLaTeX cannot find a Type 1 version of a font, it embeds the TeX bitmap (PK) font as a Type3 font. This happens, for example, with \usepackage[T1]{fontenc} on a TeX installation without cm-super (a minimal TinyTeX install is one). pdfTeX names each glyph after its own decimal character code (/Differences [44 /a44 46 /a46 68 /a68 ...]) and writes no /ToUnicode.

docling-parse looks these names up in the glyph tables, and /a1 ... /a191 are in the ITC Zapf Dingbats list (glyphs/standard/zapfdingbats.dat), which is loaded for every font. So /a76 (code 76, "L") becomes U+25B2 "▲", /a101 ("e") becomes "❡", and so on. Names with no dingbat entry (/a114, /a115, /a116) are kept as literal text. A whole page of text comes out as dingbats.

Reproduction (t1.tex, pdfTeX 3.141592653-2.6-1.40.29, TeX Live 2026, no cm-super):

\documentclass{article}
\usepackage[T1]{fontenc}
\pagestyle{empty}
\begin{document}
Docling parses this sentence, typeset by pdfLaTeX in a bitmap font.
\end{document}
from docling_parse.pdf_parser import DoclingPdfParser
doc = DoclingPdfParser(loglevel="fatal").load("t1.pdf")
print([c.text for c in doc.get_page(1).textline_cells])
Extractor Text
docling-parse 7.26.0 ❉♦❝❧✐♥❣ ♣❛a114a115❡a115 a116❤✐a115 a115❡♥a116❡♥❝❡✱ a116②♣❡a115❡a116 ❜② ♣❞❢▲❛❚❡❳ ✐♥ ❛ ❜✐a116♠❛♣ ❢♦♥a116✳
pypdfium2 5.15.2 (PDFium) Docling parses this sentence, typeset by pdfLaTeX in a bitmap font.
pdfminer.six 20260107 Docling parses this sentence, typeset by pdfLaTeX in a bitmap font.
pypdf 7.1.0 Docling parses this sentence, typeset by pdfLaTeX in a bitmap font.

A Type3 font with the same glyphs and an empty /Differences vector (or no /Encoding) already extracts correctly, so the base-encoding fallback works. Only the glyph-name lookup gets in the way.

The Zapf Dingbats names only mean dingbats in the ZapfDingbats font. A /Differences vector in which every name is /a<n> at code n (or .notdef), in a Type3 font, is pdfTeX's convention. That is the same kind of whole-vector check the parser already does for the G<decimal> names. A synthetic one-glyph-per-code font reproduces it too (Let and. comes out as ▲❡a116✥❛♥❞✳).

I have a small fix and a unit test that fails on main. I can open a pull request, and a regression-dataset pull request with the pdfLaTeX document, if this approach is acceptable.

This issue was drafted with Claude Code (claude-opus-5-5); the results above are from the runs described.

Dominant language
C++
Stars
352
Forks
99
Avg merge
1d 21h
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docling-project/docling-parse

All issues in docling-project/docling-parse

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.