embedding and using font at document level
I am using a font that allows embedding, which I need to do to make the document truly portabe (so people can see characters from a custom font without having it installed). I was using the code at the bottom of this message. The issue is that it is embedding the font every time I write something. I looked for fuctions to embed it once at the document level and then find and use it if there (or embed if not), but it is not at all obvious to me what those functions might be.
PDSysFont sysFont = PDFindSysFont(&pdeFontAttrs, sizeof(PDEFontAttrs), 0);
// Get the font attributes.
PDSysFontGetAttrs(sysFont, &pdeFontAttrs, sizeof(pdeFontAttrs));
// Create the PDE font from the system font.
// Check the font embedding bits for preview and print, or editing.
// Based on the font embedding bits, decide whether to embed or subset
// the font.
PDEFont pdeFont = NULL;
ASUns32 fontCreateFlags;
if ((pdeFontAttrs.protection & kPDEFontNoEditableEmbedding) == 0)
{
// Editing OK. Embed the entire font.
fontCreateFlags = kPDEFontCreateEmbedded;
}
else if ((pdeFontAttrs.protection & kPDEFontNoEmbedding) == 0)
{
// Preview and print embedding OK, editing is NOT OK.
// Subset the embedded font.
fontCreateFlags = kPDEFontCreateEmbedded|kPDEFontWillSubset;
}
else
{
// Embedding not allowed.
fontCreateFlags = kPDEFontDoNotEmbed;
}
// trying not embedding; tmie to create legend is crazy
fontCreateFlags = kPDEFontDoNotEmbed;
// Create the PDE font. Embed if embedding information allows.
pdeFont = PDEFontCreateFromSysFont(sysFont, fontCreateFlags);
/* If font found, proceed */
if (pdeFont)
{
