*/
public static PDFont createFont( COSDictionary dic ) throws IOException
{
PDFont retval = null;
COSName type = (COSName)dic.getDictionaryObject( COSName.TYPE );
if( !type.equals( COSName.FONT ) )
{
throw new IOException( "Cannot create font if /Type is not /Font. Actual=" +type );
}
COSName subType = (COSName)dic.getDictionaryObject( COSName.SUBTYPE );
if( subType.equals( COSName.TYPE1) )
{
retval = new PDType1Font( dic );
COSDictionary fontDic = (COSDictionary)dic.getDictionaryObject(COSName.FONT_DESC);
if( fontDic != null )
{
COSStream ffStream = (COSStream)fontDic.getDictionaryObject("FontFile");
COSStream ff3Stream = (COSStream)fontDic.getDictionaryObject("FontFile3");
if( ffStream == null && ff3Stream != null )
{
String ff3SubType = ff3Stream.getNameAsString(COSName.SUBTYPE);
if( ff3SubType.equals("Type1C") )
{
retval = new PDType1CFont( dic );
}
}
}
}
else if( subType.equals( COSName.MM_TYPE1 ) )
{
retval = new PDMMType1Font( dic );
}
else if( subType.equals( COSName.TRUE_TYPE ) )
{
retval = new PDTrueTypeFont( dic );
}
else if( subType.equals( COSName.TYPE3 ) )
{
retval = new PDType3Font( dic );
}
else if( subType.equals( COSName.TYPE0 ) )
{
retval = new PDType0Font( dic );
}
else if( subType.equals( COSName.CID_FONT_TYPE0 ) )
{
retval = new PDCIDFontType0Font( dic );
}
else if( subType.equals( COSName.CID_FONT_TYPE2 ) )
{
retval = new PDCIDFontType2Font( dic );
}
else
{