KurtCode / PDFKitten

A framework for extracting data from PDFs in iOS
MIT License
391 stars 113 forks source link

Problem with determining special characters width #13

Open slitskevich opened 12 years ago

slitskevich commented 12 years ago

I've got a problem with some special characters, e.g. ™ or even ". The Type 1 font Widths array doesn't have a value for them. Their width is considered to be 0 in Scanner's didScanCharacter. As a result the text matrix is not properly transformed and selections found in the line after the character have wrong transformation and are not properly highlighted.

I noticed that the characters are not properly processed by CGPDFStringCopyTextString and CGPDFStringGetBytePtr either. I tried to read font program stored in the font description under FontFile3 but i don't know how to process the stream.

Do you have an idea where in the pdf can i retrieve the information about corresponding glyphs? I'd really appreciate any help!

KurtCode commented 12 years ago

Personally I won't touch the font program, and I don't believe (not sure) it contains any metrics either, it should just draw the glyph.

On 2 dec 2011, at 09:54, slava litskevichreply@reply.github.com wrote:

I've got a problem with some special characters, e.g. ™ or even ". The Type 1 font Widths array doesn't have a value for them. Their width is considered to be 0 in Scanner's didScanCharacter. As a result the text matrix is not properly transformed and selections found in the line after the character have wrong transformation and are not properly highlighted.

I noticed that the characters are not properly processed by CGPDFStringCopyTextString and CGPDFStringGetBytePtr either. I tried to read font program stored in the font description under FontFile3 but i don't know how to process the stream.

Do you have an idea where in the pdf can i retrieve the information about corresponding glyphs? I'd really appreciate any help!


Reply to this email directly or view it on GitHub: https://github.com/KurtCode/PDFKitten/issues/13