How to share embedded fonts?

Q: In the course of making a document I am changing fonts several times.
Each are embedded. Acrobat analysis reveals a given font may be embedded
multiple times. After running Acrobat optimizer, each font variation is
embedded only once. If it is possible, I would like to be able to do
this from the SDK API.

images, XObjects, ICC profiles, shadings, etc) throughout the

Instead of creating a font multiple times (using
pdftron.PDF.Font.Create() methods) create a font only one time and
then keep on referencing the same font/resource throughout the
document. For example, in your class you could declare the following

  pdftron.PDF.Font myfont = null;
  pdftron.PDF.ElementBuilder builder = null;
  pdftron.PDF.ElementWriter writer = null;

  MyClassInit() {
   builder = new ElementBuilder();
   writer = new ElementWriter();
   myfont = Font.CreateTrueTypeFont(doc, fontpath + "myfont.ttf");

void AddSomeText(Page page)
// Begin writing to the page

// Begin writing a block of text
Element element = builder.CreateTextBegin(myfont, 12);

string txt = "Hello World!";
element = builder.CreateTextRun(txt);
// Scale-up text 5 times and shift it by (0,600)
element.SetTextMatrix(5, 0, 0, 5, 0, 600);

// Finish the block of text

All text created using AddSomeText() will reference the single font
instance "myfont". Reusing fonts will result in smaller PDF files and
faster execution.

Also you will notice that in the above code ElementBuilder &
ElementWriter are being reused similar to the font resource. Because
these objects are not repeatly created and destroyed this pattern will
result in significant speed and memory improvements (especially for
managed environments such as .NET or JAVA).
A: Using PDFNet library you can share Fonts and other resources (e.g.