Process a directory potentially full of fonts

@param dir The directory of fonts to process
@param fonts The fonts list to add to
175233
private static void processFontDirectory(File dir, ArrayList fonts) {
		if (!dir.exists()) {
			return;
		}
		if (processed.contains(dir)) {
			return;
		}
		processed.add(dir);
		
		File[] sources = dir.listFiles();
		if (sources == null) {
			return;
		}
		
		for (int j=0;j<sources.length;j++) {
			File source = sources[j];
		
			if (source.getName().equals(".")) {
				continue;
			}
			if (source.getName().equals("..")) {
				continue;
			}
			if (source.isDirectory()) {
				processFontDirectory(source, fonts);
				continue;
			}
			if (source.getName().toLowerCase().endsWith(".ttf")) {
				try {
					if (statusListener != null) {
						statusListener.updateStatus("Processing "+source.getName());
					}
					FontData data = new FontData(new FileInputStream(source), 1);
					fonts.add(data);
					
					String famName = data.getFamilyName();
					if (!families.contains(famName)) {
						families.add(famName);
					}
					
					boolean bo = data.getJavaFont().isBold();
					boolean it = data.getJavaFont().isItalic();
					
					if ((bo) && (it)) {
						bolditalic.put(famName, data);
					} else if (bo) {
						bold.put(famName, data);
					} else if (it) {
						italic.put(famName, data);
					} else {
						plain.put(famName, data);
					}
				} catch (Exception e) {
					if (DEBUG) {
						System.err.println("Unable to process: "+source.getAbsolutePath()+" ("+e.getClass()+": "+e.getMessage()+")");
					}
					if (statusListener != null) {
						statusListener.updateStatus("Unable to process: "+source.getName());
					}
				}
			}
		}	
	}
1013860
def _installed_fonts(cls):
        
        fonts = {}
        for d in cls._font_directories():
            for key, path in cls._iter_font_files_in(d):
                fonts[key] = path
        return fonts
3766
public static void deleteDirOnExit(final File dir) {
        if (dir.isDirectory()) {
            final String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                deleteDirOnExit(new File(dir, children[i]));
            }
        }

        // The directory is now empty so delete it
        dir.deleteOnExit();
    }
305357
@Override
    public void scanDirectoryNoResults(
            File directory, FileFilter fileFilter, Function<Resource, ?> fileProcessor) {
        this.scanDirectory(directory, null, fileFilter, fileProcessor);
    }
318758
private void addFilesFromDir(File dir) {
    File[] files = dir.listFiles();
    for (int i = 0; i < files.length; i++) {
      if (!files[i].isDirectory()) {
        mFiles.add(files[i]);
      } else if (mRecursive) {
        addFilesFromDir(files[i]);
      }
    }
  }
607573
public void setFont(Font font) {
		super.setFont(font);

		if (dayChooser != null) {
			dayChooser.setFont(font);
			monthChooser.setFont(font);
			yearChooser.setFont(font);
		}
	}
309058
private void deleteDir(File dir)
    {
        if (dir.exists() && dir.isDirectory())
        {
            File[] files = dir.listFiles();

            for (int idx = 0; idx < files.length; idx++)
            {
                if (!files[idx].exists())
                {
                    continue;
                }
                if (files[idx].isDirectory())
                {
                    deleteDir(files[idx]);
                }
                else
                {
                    files[idx].delete();
                }
            }
            dir.delete();
        }
    }
626525
def add_font(font_file, font_name=None):
    
    global font_dir

    if font_name is None:
        # determine family name from filename of font
        dirname, filename = os.path.split(font_file)
        font_name, ext = os.path.splitext(filename)

    font_dir[font_name] = Bunch.Bunch(name=font_name, font_path=font_file)

    return font_name
234580
public int insertDirectory(String dir) {
        File file = new File(dir);
        if (!file.exists() || !file.isDirectory())
            return 0;
        File files[] = file.listFiles();
        if (files == null)
        	return 0;
        int count = 0;
        for (int k = 0; k < files.length; ++k) {
            file = files[k];
            String name = file.getPath().toLowerCase();
            try {
                if (name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".afm")) {
                    Object allNames[] = BaseFont.getAllFontNames(file.getPath(), BaseFont.CP1252, null);
                    insertNames(allNames, file.getPath());
                    ++count;
                }
                else if (name.endsWith(".ttc")) {
                    String ttcs[] = BaseFont.enumerateTTCNames(file.getPath());
                    for (int j = 0; j < ttcs.length; ++j) {
                        String nt = file.getPath() + "," + j;
                        Object allNames[] = BaseFont.getAllFontNames(nt, BaseFont.CP1252, null);
                        insertNames(allNames, nt);
                    }
                    ++count;
                }
            }
            catch (Exception e) {
            }
        }
        return count;
    }
1221189
public static void directoryCheck(String dir) throws IOException {
		final File file = new File(dir);

		if (!file.exists()) {
			FileUtils.forceMkdir(file);
		}
	}
790066
public void setDir(java.lang.String dir) {
        getStateHelper().put(PropertyKeys.dir, dir);
        handleAttribute("dir", dir);
    }
355497
public void process(File[] zipFiles, File[] jarFiles, File destDir) throws IOException {
        processZips(zipFiles, destDir);
        processJars(jarFiles, destDir);
    }
478577
private void listFiles(File dir, List<File> results) {
        File[] found = dir.listFiles();
        if ( found != null ) {
            for ( File f : found ) {
                if (f.isDirectory()) {
                	//do nothing
                } else {
                    results.add(f);
                }
            }
        }
    }
763478
public static function registerFonts($fonts = array())
    {
        if (empty($fonts))
            return;

        foreach ($fonts as $font) {
            Icon::registerIconFontSet($font);
        }
    }
1144817
public void addWatchDirectory(File dir, List<String> fileExtensions) {
    	List<String> fileExtensionsWithoutDot = new ArrayList<String>(fileExtensions.size());
    	for(String fileExtension : fileExtensions){
    		fileExtensionsWithoutDot.add(removeStartingDotIfPresent(fileExtension));
    	}
    	directoryWatcherDelegate.addWatchDirectory(dir, fileExtensions);
    }
677182
public void setFont(Font font) {
		if (isInitialized) {
			dateEditor.getUiComponent().setFont(font);
			jcalendar.setFont(font);
		}
		super.setFont(font);
	}
275533
public static boolean deleteDir(File dir) {        
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (String file : children) {
                boolean success = deleteDir(new File(dir, file));
                if (!success) {
                    return false;
                }
            }
        }

        // The directory is now empty so delete it
        return dir.delete();
    }