How do I find out if PDF font is subsetter using PDFNet SDK?

Q:

We use PDFTron PDFNet SDK in our application to extract information from PDF files. Using PDFTron code, is there any way to identify whether the font is embedded or Embedded Subset.?

Basically, we need to classify embedded and embedded subset (similar to Font tab in Acrobat Reader). We use the following line of code to identify font embedding. But code returns “true” for both the cases:

pdftron.PDF.Font font = new pdftron.PDF.Font(fnt_dict);

bool is_embedded = font.IsEmbedded();

A:

A quick way to identify if a PDF font is subsetted is to check if the font name is prefixed with a 6 character string followed by ‘+’. For example:

bool IsSubsetted(Font f) {

// Check for a subset prefix in the font name.

string fn = f.GetName();

int idx = fn.find_first_of(’+’);

return (idx==6 && fn.size()>7);

}

This is the same technique used to classify fonts in Acrobat’s font dialog.