Guest User

Untitled

a guest
Apr 3rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. EPdfFontType PdfFontFactory::GetFontType( const char* pszFilename )
  2. {
  3.     EPdfFontType eFontType = ePdfFontType_Unknown;
  4.  
  5.     // We check by file extension right now
  6.     // which is not quite correct, but still better than before
  7.  
  8.     if( pszFilename && strlen( pszFilename ) > 3 )
  9.     {
  10.         const char* pszExtension = pszFilename + strlen( pszFilename ) - 3;
  11.         if( PoDoFo::compat::strncasecmp( pszExtension, "ttf", 3 ) == 0 )
  12.             eFontType = ePdfFontType_TrueType;
  13.         else if( PoDoFo::compat::strncasecmp( pszExtension, "otf", 3 ) == 0 )
  14.             eFontType = ePdfFontType_TrueType;
  15.         else if( PoDoFo::compat::strncasecmp( pszExtension, "ttc", 3 ) == 0 )
  16.             eFontType = ePdfFontType_TrueType;
  17.         else if( PoDoFo::compat::strncasecmp( pszExtension, "pfa", 3 ) == 0 )
  18.             eFontType = ePdfFontType_Type1Pfa;
  19.         else if( PoDoFo::compat::strncasecmp( pszExtension, "pfb", 3 ) == 0 )
  20.             eFontType = ePdfFontType_Type1Pfb;
  21.     }
  22.  
  23.     return eFontType;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment