public void generateFontMetrics() throws Exception {
		MessageHandler.setScreenLogger(new NullLogger());
		Driver driver = new Driver();
		driver.setLogger(new org.apache.avalon.framework.logger.NullLogger());
		String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(Locale.getDefault());
		String[] fontStyle = { "", " bold", " italic", " bold italic" };
		FontDetails fd = new FontDetails();
		String fontfilepath = "";
		String metricsPath ="PDFGeneration"+ File.separator+ "fonts";
		File pdfgeneration =new File("PDFGeneration");
		File fonts_pdfgeneration =new File("PDFGeneration"+ File.separator+ "fonts");

		if (!(pdfgeneration.isDirectory()) || !(pdfgeneration.exists())) {
			try {
				pdfgeneration.mkdir();
			} catch (SecurityException se) {
				se.printStackTrace();
			}
		}

		if (!(fonts_pdfgeneration.isDirectory())	|| !(fonts_pdfgeneration.exists())) {
			try {
				fonts_pdfgeneration.mkdir();
			} catch (SecurityException se) {
				se.printStackTrace();
			}
		}

		StringBuffer sb_userconfig = new StringBuffer();
		StringBuffer sb_start = new StringBuffer();

		String str_path = "";
		File file = null;
		TTFReader app = new TTFReader();
		TTFFile ttf = new TTFFile();
		FontFileReader reader = null;
		org.w3c.dom.Document doc = null;
		for (int i = 0; i < fontNames.length; i++) {
			for (int j = 0; j < fontStyle.length; j++) {
				fontfilepath = fd.GetFontFileName(fontNames[i] + fontStyle[j]);
				if (fontfilepath != null) {
					try {
						try {
							reader = new FontFileReader(fontfilepath);
							ttf.readFont(reader, fontNames[i]);
						} catch (IOException ioe) {
							System.out.println("IOException occured while reading the font");
						} catch (Exception e) {
							System.out.println("exception occured while reading the font");
						}

						if (ttf != null) {

							String str_file =	metricsPath	+ File.separator 
									    + fontfilepath.substring(
										fontfilepath.lastIndexOf("\\") + 1,
										fontfilepath.lastIndexOf("."))+ ".xml";
							doc =	app.constructFontXML(ttf,fontNames[i] + fontStyle[j],"","",	"",false,"");
							file = new File(str_file);
							if (!file.exists()) {
								app.writeFontXML(doc, str_file);
							}
							if (i == 0) {
								str_path = replace(file.getCanonicalPath(), "\\", "/");
							}
							sb_userconfig.append("\n\n<font metrics-file=\"file:///"+ replace(file.getCanonicalPath(), "\\", "/")+ "\"");
							sb_userconfig.append(" kerning=\"yes\"");
							sb_userconfig.append(" embed-file=\"" + replace(fontfilepath, "\\", "/")+ "\">\n");
							sb_userconfig.append("<font-triplet name=\"" + fontNames[i] + "\"");
							if (j == 0) {
								sb_userconfig.append(" style=\"normal\" weight=\"normal\"/>\n");
							} else if (j == 1) {
								sb_userconfig.append(" style=\"normal\" weight=\"bold\"/>\n");
							} else if (j == 2) {
								sb_userconfig.append(" style=\"italic\" weight=\"normal\"/>\n");
							} else {
								sb_userconfig.append(" style=\"italic\" weight=\"bold\"/>\n");
							}
							sb_userconfig.append("</font>");
						} //end if (ttf != null)

					} catch (Exception e) {
						System.out.println("Exception occured ..... ");
					}
				} //end if fontfilepath != null
			}
		}
		sb_userconfig.append("\n</fonts>\n");
		sb_userconfig.append("</configuration>");

		sb_start.append(
			"<configuration>\n<entry>\n<key>baseDir</key>\n<value></value>\n</entry>\n\n");
		sb_start.append(
			"<entry>\n<key>fontBaseDir</key>\n<value>"
				+ str_path.substring(0, str_path.lastIndexOf("/"))
				+ "</value>\n</entry>\n\n");
		sb_start.append("<fonts>\n");
		sb_start.append(sb_userconfig.toString());

		FileWriter fw = null;
		File file_userconfig =
			new File(metricsPath + File.separator + "userconfig.xml");
		if (file_userconfig.exists()) {
			file_userconfig.delete();
		}
		fw = new FileWriter(metricsPath + File.separator + "userconfig.xml");
		fw.write(sb_start.toString());
		fw.flush();
		fw.close();
	}