@@ -109,8 +109,12 @@ public DefaultFontProvider() {
109109 public DefaultFontProvider (boolean registerStandardPdfFonts , boolean registerShippedFreeFonts , boolean registerSystemFonts ) {
110110 super (registerStandardPdfFonts , registerSystemFonts );
111111 if (registerShippedFreeFonts ) {
112- addShippedFreeFonts (null );
113- addCalligraphFonts ();
112+ if (checkCalligraphFonts () != null ) {
113+ addShippedFreeFonts (FREE_FONT_RANGE );
114+ addCalligraphFonts ();
115+ } else {
116+ addShippedFreeFonts (null );
117+ }
114118 }
115119 }
116120
@@ -136,15 +140,13 @@ private void addShippedFreeFonts(Range rangeToLoad) {
136140 * If it's needed to have a DefaultFontProvider without typography fonts loaded,
137141 * create an extension of DefaultFontProvider and override this method so it does nothing and only returns null.
138142 *
143+ *
139144 * @return a unicode {@link Range} that excludes the loaded from pdfCalligraph fonts,
140145 * i.e. the unicode range that is to be rendered with any other font contained in this FontProvider
141146 */
142147 protected Range addCalligraphFonts () {
143148 String methodName = "loadShippedFonts" ;
144- Class <?> klass = null ;
145- try {
146- klass = getTypographyUtilsClass ();
147- } catch (ClassNotFoundException ignored ) { }
149+ Class <?> klass = checkCalligraphFonts ();
148150 if (klass != null ) {
149151 try {
150152 Method m = klass .getMethod (methodName );
@@ -161,6 +163,14 @@ protected Range addCalligraphFonts() {
161163 return null ;
162164 }
163165
166+ private Class <?> checkCalligraphFonts () {
167+ Class <?> klass = null ;
168+ try {
169+ klass = getTypographyUtilsClass ();
170+ } catch (ClassNotFoundException ignored ) { }
171+ return klass ;
172+ }
173+
164174 private static Class <?> getTypographyUtilsClass () throws ClassNotFoundException {
165175 String typographyClassFullName = "com.itextpdf.typography.util.TypographyShippedFontsUtil" ;
166176 return Class .forName (typographyClassFullName );
0 commit comments