In follow up of my previous questions, trying to extract the text from a PDF file using the CGPDF* functions, having a:
CGPDFStringRef pdfString
I figured out that it can be converted to an array of character codes like this:
const unsigned char *characterCodes = CGPDFStringGetBytePtr(pdfString);
Now, the text I'm trying to extract is written in one of the 14 type 1 base font's which is not encode in the PDF itself. Therefor, I have parsed the relevant AFM file for that font giving me a mapping from character code to glyph name and it's dimensions like so:
C 61 ; WX 600 ; N equal ; B 80 138 520 376 ;
C 63 ; WX 600 ; N question ; B 129 -15 492 572 ;
C 64 ; WX 600 ; N at ; B 77 -15 533 622 ;
C 65 ; WX 600 ; N A ; B 3 0 597 562 ;
C 66 ; WX 600 ; N B ; B 43 0 559 562 ;
My question is, knowing the character code, say:"61" how do I go from it's glyph name:"equal" to a NSString @"=". Especially when that character code is remapped to an other glyph name, say, for instance: "question" by the PDF's font encoding option.
Previous questions: iOS PDF parsing Type 1 Fonts metrics and iOS PDF to plain text parser