if( widths != null )
{
boolean foundWidth = false;
for( int i=0; !foundWidth && i<widths.size(); i++ )
{
COSNumber firstCode = (COSNumber)widths.getObject( i++ );
COSBase next = widths.getObject( i );
if( next instanceof COSArray )
{
COSArray array = (COSArray)next;
if( code >= firstCode.intValue() &&
code < firstCode.intValue() + array.size() )
{
COSNumber rangeWidth =
(COSNumber)array.get( code - firstCode.intValue() );
retval = rangeWidth.floatValue();
foundWidth = true;
}
}
else
{
COSNumber secondCode = (COSNumber)next;
i++;
COSNumber rangeWidth = (COSNumber)widths.getObject( i );
if( code >= firstCode.intValue() &&
code <= secondCode.intValue() )
{
retval = rangeWidth.floatValue();
foundWidth = true;
}
}
}
widthCache.put( new Integer( code ), new Float( retval ) );