Space glyph drawn on top of the previous glyph splits words ("specifi cations", "Th e")
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the semantic-space check in cells.h around line 1395, then compare how the repro PDF’s overlapping space is handled with the ordinary space on the second line. The issue includes a Python script to generate repro.pdf and run the parser; check the resulting text against the expected unbroken words. The report says the author can test a patch on the manual.
索引モデルが issue の本文から書いたものです。
説明
Some typeset PDFs put a space glyph after each ligature and kern it back over the ligature (net advance zero, nothing visible):
[(Speci\035)257 ( )-58 (cations)] TJ
\035 maps to "fi" correctly. The space cell sits inside the fi cell:
'fi' x0=419.26 x1=425.43
' ' x0=422.35 x1=424.74
'c' x0=425.43 x1=430.14
docling-parse treats it as a word boundary, giving "specifi cations", "Th e", "fi nal". About 960 broken words in a 438-page InDesign manual. pdftotext drops the overlapped space and reads it fine.
Not the zero-width case from #328. Still there in 7.26.0.
Repro (plain Helvetica, no ligature font needed):
stream = b"\n".join([
b"BT /F1 20 Tf 72 700 Td [(The specifi)336 ( )-58 (cations are fi)336 ( )-58 (nal.)] TJ ET",
b"BT /F1 20 Tf 72 660 Td (The specifications are final.) Tj ET",
])
objs = [
b"<< /Type /Catalog /Pages 2 0 R >>",
b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 4 0 R >> >> /Contents 5 0 R >>",
b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>",
b"<< /Length %d >>\nstream\n" % len(stream) + stream + b"\nendstream",
]
out = bytearray(b"%PDF-1.4\n"); offs = []
for n, o in enumerate(objs, 1):
offs.append(len(out)); out += b"%d 0 obj\n" % n + o + b"\nendobj\n"
x = len(out); out += b"xref\n0 %d\n0000000000 65535 f \n" % (len(objs) + 1)
for o in offs: out += b"%010d 00000 n \n" % o
out += b"trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objs) + 1, x)
open("repro.pdf", "wb").write(out)
from docling_parse.pdf_parser import DoclingPdfParser
for _, page in DoclingPdfParser().load(path_or_stream="repro.pdf").iterate_pages():
print([c.text for c in page.textline_cells])
7.26.0: ['The specifi cations are fi nal.', 'The specifications are final.']
pdftotext: "The specifications are final." on both lines.
Likely spot: the semantic-space check in cells.h (~line 1395). Ignoring a space when there is no gap between the glyphs on either side would match poppler. I can test a patch on the manual.
Same symptom reported in docling-project/docling#3420.
- 主要言語
- C++
- スター
- 352
- フォーク
- 99
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 37
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docling-project/docling-parse のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
docling-project/docling-parse#448 ·
メンテナーはふだん 1 日以内に返信
-
Persian and Arabic-Indic numbers come out reversed in right-to-left text (`۱۴۰۱` → `۱۰۴۱`, `۹٬۰۳۹٬۰۰۰` → `۰۰۰٬۹۳۰٬۹`)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
docling-project/docling-parse#492 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
docling-project/docling-parse#487 ·
メンテナーはふだん 1 日以内に返信
-
7.25.0 splits letter-spaced CJK runs of two to four characters into one word per character (`股本重組` -> `股 本 重 組`): `infer_unspaced_gap_profile()` needs four gaps before it sees tracking対応中かも @jjohnnystwsss が 4 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
docling-project/docling-parse#483 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
docling-project/docling-parse#482 ·
メンテナーはふだん 1 日以内に返信
docling-project/docling-parse の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 2 日以内に返信
-
Missing repro Platform: Android
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
software-mansion/react-native-reanimated#11554 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Niko1221/Strata#7211 · コメント 3 件 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sleepyviper1213/redis#52 ·