public static FontDetails create( String fontName, Properties fontMetricsProps ){String heightStr = fontMetricsProps.getProperty( buildFontHeightProperty(fontName) );String widthsStr = fontMetricsProps.getProperty( buildFontWidthsProperty(fontName) );String charactersStr = fontMetricsProps.getProperty( buildFontCharactersProperty(fontName) );if(heightStr == null || widthsStr == null || charactersStr == null) {throw new IllegalArgumentException("The supplied FontMetrics doesn't know about the font '" + fontName + "', so we can't use it. Please add it to your font metrics file (see StaticFontMetrics.getFontDetails");}int height = Integer.parseInt(heightStr);FontDetails d = new FontDetails(fontName, height);String[] charactersStrArray = split(charactersStr, ",", -1);String[] widthsStrArray = split(widthsStr, ",", -1);if (charactersStrArray.length != widthsStrArray.length)throw new RuntimeException("Number of characters does not number of widths for font " + fontName);for ( int i = 0; i < widthsStrArray.length; i++ ){if (charactersStrArray[i].length() != 0)d.addChar(charactersStrArray[i].charAt(0), Integer.parseInt(widthsStrArray[i]));}return d;}

public static FontDetails Create(String fontName, Properties fontMetricsProps){String heightStr = fontMetricsProps[BuildFontHeightProperty(fontName)];String widthsStr = fontMetricsProps[BuildFontWidthsProperty(fontName)];String CharsStr = fontMetricsProps[BuildFontCharsProperty(fontName)];if (heightStr == null || widthsStr == null || CharsStr == null){throw new ArgumentException("The supplied FontMetrics doesn't know about the font '" + fontName + "', so we can't use it. Please Add it to your font metrics file (see StaticFontMetrics.GetFontDetails");}int height = int.Parse(heightStr, CultureInfo.InvariantCulture);FontDetails d = new FontDetails(fontName, height);String[] CharsStrArray = Split(CharsStr, ",", -1);String[] widthsStrArray = Split(widthsStr, ",", -1);if (CharsStrArray.Length != widthsStrArray.Length)throw new Exception("Number of Chars does not number of widths for font " + fontName);for (int i = 0; i < widthsStrArray.Length; i++){if (CharsStrArray[i].Trim().Length != 0)d.AddChar(CharsStrArray[i].Trim()[0], int.Parse(widthsStrArray[i], CultureInfo.InvariantCulture));}return d;}
