How to deal with missing characters in the default font of a text field?

Tags: formstext fieldfontsiText 5

We are using iText to create PDFs using a custom font and I am running into an issue with the unicode character 2120 (SM, Service Mark). The problem is the glyph is not in the custom font. Is there a way I can specify a fallback font for a field in a PDF? We tried adding a text field with Verdana so that the form had the secondary font embedded in it but that didn't seem to help.

Posted on StackOverflow on Nov 7, 2013 by El Hombre

First you just need to add substitutions fonts to the form:

AcroFields form = stamper.getAcroFields();

Now the font defined in the form has preference, but if that font can't show a specific glyph, it will look at bf1, then at bf2 and so on.