Podofo Pdf Library GetGlyphID?
-
I'm not sure if I can ask this here because it is for an open source library called Podofo. I'm asked this on their mailing lists but it could be some time before someone responds. If this is the wrong place to ask this question then please let me know and I'll just remove it. I was hoping that maybe someone else out there uses this library and has some experience in dealing with this problem. The function PdfFontMetrics::GetGlyphID should return the Glyph ID for a given character represented by it's unicode codepoint (as a long). To make things easier I have written a small program greatly simplifying and hopefully clarifying my problem. I hope I haven't over simplified things but the PdfFontMetrics object seems to work in some case but not when looking for the Glyph ID. This is a small command line program. For now, it's whole purpose is to find the Glyph ID for each character handed to the GetGlyphID function. There are some other output messages in there to prove that the PdfFont has been loaded. This library uses Freetype2 as a dependency and when using the GetGlyphID function it eventually calls the FT_Get_Char_Index( FontFace(this is preloaded), Unicode(unicode value codepoint) ) which is a Freetype function as part of it's API. One of the fonts, represented as Font Name: LNCKCK+TimesNewRomanPSMT represents the one of the preloaded font names my program searches for when seeking the Glyph ID. I'm assuming that this isn't found because the GetGlyphID function is telling me that it can't find the Glyph ID by returning Zero. It is highly likely that there is some problem with the font name and thus the glyph search ends early. Here's the code. Please see the comments below where I have extracted the TJ array and attempt to find the Glyph ID for individual characters. The line commented with "// NOW ATTEMPT TO EXTRACT GLYPH INFORMATION" is where I try to get the Glyph ID. I just can't see where I'm going wrong. Can anyone help? Thanks
#include #include #include #include #include using namespace PoDoFo;
using namespace std;PdfMemDocument doc;
int page_count;
PdfPage *page;EPdfContentsType type;
PdfVariant var;
const char* token;PdfFont *Font;
const PdfFontMetrics *met;PdfArray pArray; // for extracting text under TJ operator
int size_of_array;
string TJ_string;stack PdfStack;
//THE PURPOSE OF THIS SMALL PROGRAM IS TO SHOW HOW I AM EXTRACTING THE GLYPH ID.
long