Q: I used ElementBuilder to embed Arial Font using Font File by
setting the subset to true and false. When I set the Subset to false
and extracted the Font into the file(using my Java program and
CosEdit), the file size (359k) was same as the original one, And could
open the Font in the Windows system. When I set the Subset to false, I
could still extract the Font into a Font File, the size was much
lower(59k). But what surprised me was that I could still open the Font
in Windows and also convert that Font to Java Font. When I opened the
59k Font File, It looked the same as the 359k Font File. Can you
please explain me what did the subsetting remove from the Font File?
We are going to allow editing of the PDF, how do we test that the
embedded fonts in the incoming pdf have the entire font file to allow
what did the subsetting remove from the Font File?
PDFNet removes unused glyphs in the font as well as other information
that is not required for accurate reproduction of the document (hence
the reduction in file size for the embedded font). The subsetted font
is also a valid font and in most cases it can be opened using the font
inspector. The problem occurs if you later try to reference glyphs
that are not present in the subsetted font. Some characters may
render as ‘.notdef’ glyph or as empty spaces, etc.
In case you would like to preserve text editing on a small character
subset (such as ASCII) while taking advantage of font subsetting you
can use the following technique:
- Create a dummy PDF page (pdfdoc.PageCreate()).
- Embed the font F with subsetting enabled: F =
- Write a dummy text run to the page using ElementBuilder/
ElementWriter (please see ElementBuilder sample project for an example
of how to add new content to a page). The text run should reference
all characters that should not be removed from the font (e.g. a
printable ASCII charset). So text editablity will be preserved for all
glyphs in this charset.
- Do not add the dummy page to the document sequence (e.g.
pdfdoc.PagePushBack(page)). This page is used only to make sure that
PDFNet does not remove glyphs from a given character set. The page
itself will not be present in the saved document.