Change the Font on just the specific Unicode characters while saving to PDF

[ ]


The following screenshot compares the two output PDFs generated by the sample code below. One was generated without setting PdfSaveOptions.setFontSubstitutionCharGranularity() property and the other was generated after setting the PdfSaveOptions.setFontSubstitutionCharGranularity() property to true. As you can see in the first PDF, the font of the entire sentence has changed from Times New Roman to Arial Unicode MS because of Non-Breaking Hyphen. While in the second PDF, only the font of Non-Breaking Hyphen has changed.