int firstchar = 255;
int lastchar = 0;
// widths
List<CharMetric> listmetric = metric.getCharMetrics();
Encoding encoding = getFontEncoding();
int maxWidths = 256;
List<Number> widths = new ArrayList(maxWidths);
Integer zero = new Integer(250);
Iterator<CharMetric> iter = listmetric.iterator();
for( int i=0; i<maxWidths; i++ )
{
widths.add(zero);
}
while (iter.hasNext())
{
CharMetric m = iter.next();
int n = m.getCharacterCode();
if (n > 0)
{
firstchar = Math.min(firstchar, n);
lastchar = Math.max(lastchar, n);
if (m.getWx() > 0)
{
float width = m.getWx();
widths.set(n,new Float(width));
// germandbls has 2 character codes !! Don't ask me why .....
// StandardEncoding = 0373 = 251
// WinANSIEncoding = 0337 = 223
if (m.getName().equals("germandbls") && n != 223)
{
widths.set(0337,new Float(width));
}
}
}
else
{
// my AFMPFB-Fonts has no character-codes for german umlauts
// so that I've to add them here by hand
if (m.getName().equals("adieresis"))
{
widths.set(0344,(Float)widths.get(encoding.getCode("a")));
}
else if (m.getName().equals("odieresis"))
{
widths.set(0366,(Float)widths.get(encoding.getCode("o")));
}
else if (m.getName().equals("udieresis"))
{
widths.set(0374,(Float)widths.get(encoding.getCode("u")));
}
else if (m.getName().equals("Adieresis"))
{
widths.set(0304,(Float)widths.get(encoding.getCode("A")));
}
else if (m.getName().equals("Odieresis"))
{
widths.set(0326,(Float)widths.get(encoding.getCode("O")));
}
else if (m.getName().equals("Udieresis"))
{
widths.set(0334,(Float)widths.get(encoding.getCode("U")));
}
}
}
setFirstChar(0);
setLastChar(255);