int registerSystemFontDirectories(){
  int count=0;
  String[] withSubDirs={FileUtil.getFontsDir(),"/usr/share/X11/fonts","/usr/X/lib/X11/fonts","/usr/openwin/lib/X11/fonts","/usr/share/fonts","/usr/X11R6/lib/X11/fonts"};
  for (  String directory : withSubDirs) {
    count+=registerFontDirectory(directory,true);
  }
  String[] withoutSubDirs={"/Library/Fonts","/System/Library/Fonts"};
  for (  String directory : withoutSubDirs) {
    count+=registerFontDirectory(directory,false);
  }
  return count;
}

int registerSystemFontDirectories ( ) { int count = 0 ; String [ ] withSubDirs = { FileUtil . getFontsDir ( ) , "/usr/share/X11/fonts" , "/usr/X/lib/X11/fonts" , "/usr/openwin/lib/X11/fonts" , "/usr/share/fonts" , "/usr/X11R6/lib/X11/fonts" } ; for ( String directory : withSubDirs ) { count += registerFontDirectory ( directory , true ) ; } String [ ] withoutSubDirs = { "/Library/Fonts" , "/System/Library/Fonts" } ; for ( String directory : withoutSubDirs ) { count += registerFontDirectory ( directory , false ) ; } return count ; }
register fonts in some probable directories . it usually works in windows , linux and solaris .
