int firstchar = 255;
int lastchar = 0;
// widths
List<CharMetric> listmetric = metric.getCharMetrics();
Encoding encoding = getFontEncoding();
int maxWidths = 256;
List<Float> widths = new ArrayList<Float>(maxWidths);
int zero = 250;
Iterator<CharMetric> iter = listmetric.iterator();
for (int i = 0; i < maxWidths; i++)
{
widths.add((float)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)
{
int width = Math.round(m.getWx());
widths.set(n, (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, (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, widths.get(encoding.getCode("a")));
}
else if (m.getName().equals("odieresis"))
{
widths.set(0366, widths.get(encoding.getCode("o")));
}
else if (m.getName().equals("udieresis"))
{
widths.set(0374, widths.get(encoding.getCode("u")));
}
else if (m.getName().equals("Adieresis"))
{
widths.set(0304, widths.get(encoding.getCode("A")));
}
else if (m.getName().equals("Odieresis"))
{
widths.set(0326, widths.get(encoding.getCode("O")));
}
else if (m.getName().equals("Udieresis"))
{
widths.set(0334, widths.get(encoding.getCode("U")));
}
}
}
setFirstChar(0);
setLastChar(255);