Skip to content

fix: ToUnicode in PDF should describe CID instead of GID - #3435

Merged
laurmaedje merged 2 commits into
typst:mainfrom
YDX-2147483647:to-unicode
Feb 17, 2024
Merged

laurmaedje merged 2 commits into
typst:mainfrom
YDX-2147483647:to-unicode

Conversation

@YDX-2147483647

Copy link
Copy Markdown
Contributor

Fixes #3416

ToUnicode makes it possible to copy and search text in PDF. Previous implementation assumes CIDs (Character IDs) and GIDs (Glyph IDs) are the same in the font, but they may differ. For example, if you testit cjk --pdf and copy texts in the generated PDFs, you will find ���. This PR fixes it.

Comment thread crates/typst-pdf/src/font.rs Resolved
@laurmaedje
laurmaedje added this pull request to the merge queue Feb 17, 2024
@laurmaedje

Copy link
Copy Markdown
Member

Great, thanks for the fix!

Merged via the queue into typst:main with commit 394864f Feb 17, 2024
@YDX-2147483647
YDX-2147483647 deleted the to-unicode branch February 17, 2024 12:49
Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToUnicode in PDF for a Type 0 CID Font might be Wrong

2 participants