{
COSArray descendantFontArray =
(COSArray)font.getDictionaryObject( COSName.DESCENDANT_FONTS );
if (descendantFontArray != null)
{
COSDictionary descendantFontDictionary =
(COSDictionary)descendantFontArray.getObject( 0 );
PDFont descendentFont = PDFontFactory.createFont( descendantFontDictionary );
COSDictionary cidsysteminfo =
(COSDictionary)descendentFont.font.getDictionaryObject(COSName.CIDSYSTEMINFO);
if (cidsysteminfo != null)
{
String ordering = cidsysteminfo.getString(COSName.ORDERING);
String registry = cidsysteminfo.getString(COSName.REGISTRY);
cmapName = registry + "-" + ordering+"-UCS2";
}
}
}
else
{
cmapName = CMapSubstitution.substituteCMap( cmapName );
}
String resourceRoot = "org/apache/pdfbox/resources/cmap/";
String resourceName = resourceRoot + cmapName;
parseCmap( resourceRoot, ResourceLoader.loadResource( resourceName ), encodingName );
if( cmap == null && !encodingName.getName().equals( COSName.IDENTITY_H.getName() ) )
{
throw new IOException( "Error: Could not find predefined " +
"CMAP file for '" + encodingName.getName() + "'" );
}
}
}
else if( encoding instanceof COSName ||
encoding instanceof COSDictionary )
{
Encoding currentFontEncoding = getEncoding();
if( currentFontEncoding != null )
{
retval = currentFontEncoding.getCharacter( getCodeFromArray( c, offset, length ) );
}
}
else
{
COSDictionary fontDescriptor =
(COSDictionary)font.getDictionaryObject( COSName.FONT_DESC );
if( isTrueTypeFont() && fontDescriptor != null &&
(fontDescriptor.getDictionaryObject( COSName.FONT_FILE )!= null ||
fontDescriptor.getDictionaryObject( COSName.FONT_FILE2 ) != null ||
fontDescriptor.getDictionaryObject( COSName.FONT_FILE3 ) != null ) )
{
//If we are using an embedded font then there is not much we can do besides
//return the same character codes.
//retval = new String( c,offset, length );
retval = getStringFromArray( c, offset, length );