code: private static void locateLinuxFonts(File file) {
  		if (!file.exists()) {
  			System.err.println("Unable to open: "+file.getAbsolutePath());
  			return;
  		}
  
  		try {
  			InputStream in = new FileInputStream(file);
  		
  			BufferedReader reader = new BufferedReader(new InputStreamReader(in));
  			ByteArrayOutputStream temp = new ByteArrayOutputStream();
  			PrintStream pout = new PrintStream(temp);
  			while (reader.ready()) {
  				String line = reader.readLine();
  				if (line.indexOf("DOCTYPE") == -1) {
  					pout.println(line);
  				}
  			}
  			
  			in = new ByteArrayInputStream(temp.toByteArray());
  		
  			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  			DocumentBuilder builder = factory.newDocumentBuilder();
  			
  			Document document = builder.parse(in);
  			
  			NodeList dirs = document.getElementsByTagName("dir");
  			for (int i=0;i<dirs.getLength();i++) {
  				Element element = (Element) dirs.item(i);
  				String dir = element.getFirstChild().getNodeValue();
  				
  				if (dir.startsWith("~")) {
  					dir = dir.substring(1);
  					dir = userhome + dir;
  				}
  				
  				addFontDirectory(new File(dir));
  			}
  			
  			NodeList includes = document.getElementsByTagName("include");
  			for (int i=0;i<includes.getLength();i++) {
  				Element element = (Element) dirs.item(i);
  				String inc = element.getFirstChild().getNodeValue();
  				if (inc.startsWith("~")) {
  					inc = inc.substring(1);
  					inc = userhome + inc;
  				}
  				
  				locateLinuxFonts(new File(inc));
  			}
  		} catch (Exception e) {
  			e.printStackTrace();
  			System.err.println("Unable to process: "+file.getAbsolutePath());
  		}
  	}
docs: Locate the linux fonts based on the XML configuration file
  
  @param file The location of the XML file