You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "fcalafat (via GitHub)" <gi...@apache.org> on 2026/10/09 14:13:20 UTC
[PR] [PDFBOX-6279] Add ToUnicode entries for glyphs produced by GSUB substitutions [pdfbox]
fcalafat opened a new pull request, #537:
URL: https://github.com/apache/pdfbox/pull/537
When `showText()` applies GSUB substitutions, a ligature glyph (like "er" or "nd" in a script font) has no cmap entry, so `PDCIDFontType2Embedder` writes no ToUnicode entry for it and text extraction drops those letters: "Registered" is extracted as "Registed".
**Fix:**
* When a glyph has no cmap entry, look it up in the font's GSUB table and write the text of the glyphs it replaces. (`pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFontType2Embedder.java`)
**Testing:**
* Added two tests that write text, extract it, and compare: Devanagari conjuncts with `Lohit-Devanagari.ttf`, and Latin letters with a combining accent with the IPA Gothic font already downloaded for the tests. Both fail without the fix. (`pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org