@@ -184,12 +184,12 @@ protected FontProgram getFontProgram(String fontName, boolean cached) throws jav
184
184
fontName = fontNames .get (fontName .toLowerCase ());
185
185
// the font is not registered as truetype font
186
186
if (fontName != null ) {
187
- fontProgram = FontFactory .createFont (fontName , cached );
187
+ fontProgram = FontProgramFactory .createFont (fontName , cached );
188
188
}
189
189
if (fontProgram == null ) {
190
190
try {
191
191
// the font is a type 1 font or CJK font
192
- fontProgram = FontFactory .createFont (fontName , cached );
192
+ fontProgram = FontProgramFactory .createFont (fontName , cached );
193
193
} catch (IOException ignored ) {
194
194
}
195
195
}
@@ -204,7 +204,7 @@ protected FontProgram getFontProgram(String fontName, boolean cached) throws jav
204
204
* @param fullName the font name
205
205
* @param path the font path
206
206
*/
207
- public void registerFamily (String familyName , String fullName , String path ) {
207
+ public void registerFontFamily (String familyName , String fullName , String path ) {
208
208
if (path != null )
209
209
fontNames .put (fullName , path );
210
210
List <String > tmp ;
@@ -246,8 +246,8 @@ public void registerFamily(String familyName, String fullName, String path) {
246
246
* @param path the path to a ttf- or ttc-file
247
247
*/
248
248
249
- public void register (String path ) {
250
- register (path , null );
249
+ public void registerFont (String path ) {
250
+ registerFont (path , null );
251
251
}
252
252
253
253
/**
@@ -257,10 +257,10 @@ public void register(String path) {
257
257
* @param alias the alias you want to use for the font
258
258
*/
259
259
260
- public void register (String path , String alias ) {
260
+ public void registerFont (String path , String alias ) {
261
261
try {
262
262
if (path .toLowerCase ().endsWith (".ttf" ) || path .toLowerCase ().endsWith (".otf" ) || path .toLowerCase ().indexOf (".ttc," ) > 0 ) {
263
- FontProgram fontProgram = FontFactory .createFont (path );
263
+ FontProgram fontProgram = FontProgramFactory .createFont (path );
264
264
Object [] allNames = new Object []{fontProgram .getFontNames ().getFontName (), fontProgram .getFontNames ().getFamilyName (), fontProgram .getFontNames ().getFullName ()};
265
265
fontNames .put (((String ) allNames [0 ]).toLowerCase (), path );
266
266
if (alias != null ) {
@@ -281,7 +281,7 @@ public void register(String path, String alias) {
281
281
saveCopyOfRegularFont (lcName , path );
282
282
}
283
283
}
284
- String fullName = null ;
284
+ String fullName ;
285
285
String familyName = null ;
286
286
names = (String [][]) allNames [1 ]; //family name
287
287
for (int k = 0 ; k < TTFamilyOrder .length ; k += 3 ) {
@@ -303,7 +303,7 @@ public void register(String path, String alias) {
303
303
if (fullName .equals (lastName ))
304
304
continue ;
305
305
lastName = fullName ;
306
- registerFamily (familyName , fullName , null );
306
+ registerFontFamily (familyName , fullName , null );
307
307
break ;
308
308
}
309
309
}
@@ -315,14 +315,14 @@ public void register(String path, String alias) {
315
315
}
316
316
TrueTypeCollection ttc = new TrueTypeCollection (path , PdfEncodings .WINANSI );
317
317
for (int i = 0 ; i < ttc .getTTCSize (); i ++) {
318
- register (path + "," + i );
318
+ registerFont (path + "," + i );
319
319
}
320
320
} else if (path .toLowerCase ().endsWith (".afm" ) || path .toLowerCase ().endsWith (".pfm" )) {
321
- FontProgram fontProgram = FontFactory .createFont (path , false );
321
+ FontProgram fontProgram = FontProgramFactory .createFont (path , false );
322
322
String fullName = fontProgram .getFontNames ().getFullName ()[0 ][3 ].toLowerCase ();
323
323
String familyName = fontProgram .getFontNames ().getFamilyName ()[0 ][3 ].toLowerCase ();
324
324
String psName =fontProgram .getFontNames ().getFontName ().toLowerCase ();
325
- registerFamily (familyName , fullName , null );
325
+ registerFontFamily (familyName , fullName , null );
326
326
fontNames .put (psName , path );
327
327
fontNames .put (fullName , path );
328
328
}
@@ -351,8 +351,8 @@ protected boolean saveCopyOfRegularFont(String regularFontName, String path) {
351
351
* @param dir the directory
352
352
* @return the number of fonts registered
353
353
*/
354
- public int registerDirectory (String dir ) {
355
- return registerDirectory (dir , false );
354
+ public int registerFontDirectory (String dir ) {
355
+ return registerFontDirectory (dir , false );
356
356
}
357
357
358
358
/**
@@ -362,7 +362,7 @@ public int registerDirectory(String dir) {
362
362
* @param scanSubdirectories recursively scan subdirectories if <code>true</true>
363
363
* @return the number of fonts registered
364
364
*/
365
- public int registerDirectory (String dir , boolean scanSubdirectories ) {
365
+ public int registerFontDirectory (String dir , boolean scanSubdirectories ) {
366
366
LOGGER .debug (MessageFormat .format ("Registering directory {0}, looking for fonts" , dir ));
367
367
int count = 0 ;
368
368
try {
@@ -376,11 +376,11 @@ public int registerDirectory(String dir, boolean scanSubdirectories) {
376
376
/* Only register Type 1 fonts with matching .pfb files */
377
377
String pfb = file .substring (0 , file .length () - 4 ) + ".pfb" ;
378
378
if (FileUtil .fileExists (pfb )) {
379
- register (file , null );
379
+ registerFont (file , null );
380
380
++count ;
381
381
}
382
382
} else if (".ttf" .equals (suffix ) || ".otf" .equals (suffix ) || ".ttc" .equals (suffix )) {
383
- register (file , null );
383
+ registerFont (file , null );
384
384
++count ;
385
385
}
386
386
} catch (Exception e ) {
@@ -399,7 +399,7 @@ public int registerDirectory(String dir, boolean scanSubdirectories) {
399
399
*
400
400
* @return the number of fonts registered
401
401
*/
402
- public int registerSystemDirectories () {
402
+ public int registerSystemFontDirectories () {
403
403
int count = 0 ;
404
404
String [] withSubDirs = {
405
405
FileUtil .getFontsDir (),
@@ -410,15 +410,15 @@ public int registerSystemDirectories() {
410
410
"/usr/X11R6/lib/X11/fonts"
411
411
};
412
412
for (String directory : withSubDirs ) {
413
- count += registerDirectory (directory , true );
413
+ count += registerFontDirectory (directory , true );
414
414
}
415
415
416
416
String [] withoutSubDirs = {
417
417
"/Library/Fonts" ,
418
418
"/System/Library/Fonts"
419
419
};
420
420
for (String directory : withoutSubDirs ) {
421
- count += registerDirectory (directory , false );
421
+ count += registerFontDirectory (directory , false );
422
422
}
423
423
424
424
return count ;
@@ -440,7 +440,7 @@ public Set<String> getRegisteredFonts() {
440
440
* @return a set of registered font families
441
441
*/
442
442
443
- public Set <String > getRegisteredFamilies () {
443
+ public Set <String > getRegisteredFontFamilies () {
444
444
return fontFamilies .keySet ();
445
445
}
446
446
@@ -449,7 +449,7 @@ public Set<String> getRegisteredFamilies() {
449
449
* @param fontname the name of the font that has to be checked.
450
450
* @return true if the font is found
451
451
*/
452
- public boolean isRegistered (String fontname ) {
452
+ public boolean isRegisteredFont (String fontname ) {
453
453
return fontNames .containsKey (fontname .toLowerCase ());
454
454
}
455
455
}
0 commit comments