Repository navigation
Keep the original text in PDF glyph clusters - #2644
Closed
yucheng-du wants to merge 1 commit into
Closed
yucheng-du wants to merge 1 commit into
yucheng-du wants to merge 1 commit into
Conversation
Collaborator
|
Thanks but I'm already working on this, and want to do it differently. In particular, we don't need to go through a JS string to get a UTF-8 value. It can just be UTF-8 from the beginning, but only when the surface requires it. |
Author
|
Thanks for the heads-up. I'll close this draft. Two cases from testing may help with your implementation. Passing a whole Hebrew run with Cairo's backwards-cluster flag reversed the copied letters in PDFium and macOS PDFKit. Sending a bitmap color emoji through the text-glyph path also removed its image from the PDF. The two Arimo tests in this branch are independent of how the UTF-8 text is obtained. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copying
किout of a v4 PDF gave�कin Poppler and PDFium. The glyphs are drawn in visual order, and Cairo has no way to recover the original letters from their IDs alone.Pass the source text and HarfBuzz cluster boundaries to Cairo for forward runs. Keep a cluster together if it crosses the 1,024-glyph buffer boundary. Backwards runs still use the existing path because changing their drawing order broke Arabic and Hebrew selection in PDF readers. Color fonts also keep their existing path so bitmap emoji still render.
Both new regression tests fail on master. All 310 unit tests pass with the change, as do lint and the type tests. I also tried 23 strings in Devanagari, Bengali, Tamil and Thai. Poppler and MuPDF recovered all 23 exactly, up from two. PDFium recovered 22. All 40 sample PDFs rendered pixel-for-pixel the same as master.
Refs #2611.