Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases for AGL. #101

Open
dannywinrow opened this issue Jan 15, 2022 · 4 comments
Open

Add test cases for AGL. #101

dannywinrow opened this issue Jan 15, 2022 · 4 comments

Comments

@dannywinrow
Copy link

dannywinrow commented Jan 15, 2022

I tried to run pdPageExtractText on the pdf located:
https://www.gov.im/media/1360682/isle-of-man-inflation-report-november-2021.pdf

However, every character of the text was being interpreted as "\0"

After much pain and effort trailing through the PDFIO code, I have identified the problem as being what is returned by the fum function in PDFont. In particular when the cn"Encoding" object contains a /Differences object with values such as /uni0047 which just represent the unicode character U+47 ('p'). Since the AGL_Glyph_To_Unicode dictionary (not sure where this comes from) doesn't contain the simple unicode mappings then the zero(Char) is returned instead.

One solution might be to just compare the /uni0047 to the base encoding dictionary and if the 0x0047 part exists then add a dictionary entry. Another solution would be to add all of the standard unicode characters that already exist in your base encoding such as /uni0047 to the AGL_Glyph_To_Unicode dictionary.

I have made the assumption, when suggesting this solution, that the cn"Encoding" object is taken directly from the pdf file and not further processed.

If you'd like me to try to create a pull request, I'd be happy to, but I thought I'd ask first in case your more holistic view of the project leads to a more effective solution.

@dannywinrow dannywinrow changed the title TrueType font not working when differences contains unicode glyphs e.g. /uni0047 Part of AGL specification not implemented Jan 16, 2022
@dannywinrow
Copy link
Author

dannywinrow commented Jan 16, 2022

I have updated this issue, since I think I have found the crux of the problem which is that PDFIO is missing part of the AGL specification which states that you first match to AGL, and if no match then you test whether it is a unicode character of the form uniXXXX or uXXXX (see specification for general case and restrictions)

@sambitdash
Copy link
Owner

6367aa6 Fixes it but no test cases are added as the file is no longer accessible.

@sambitdash
Copy link
Owner

Add test cases for AGL.

@sambitdash sambitdash reopened this Nov 20, 2022
@sambitdash sambitdash changed the title Part of AGL specification not implemented Add test cases for AGL. Nov 20, 2022
@sambitdash
Copy link
Owner

isle-of-man-inflation-report-november-2021.pdf
Adding a copy of the file which I got by Googling. But, this version does not have an AGL code. The suggested file is no longer on the site.We need to look for a better test file.

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 a pull request may close this issue.

2 participants