Kaydet (Commit) 85b9b178 authored tarafından Khaled Hosny's avatar Khaled Hosny

Use a simple boolean instead of an enum

All we need to know is whether the font format is supported or not.

Change-Id: I0e30a653f9ea70f83558632789b2db72b526ebb8
Reviewed-on: https://gerrit.libreoffice.org/52202Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKhaled Hosny <khaledhosny@eglug.org>
üst e24f5ba4
...@@ -207,11 +207,6 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName ) ...@@ -207,11 +207,6 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName )
return aFontIds; return aFontIds;
} }
enum fontFormat
{
UNKNOWN, TRUETYPE, CFF
};
std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const char *pFormat ) const std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const char *pFormat ) const
{ {
std::vector<std::unique_ptr<PrintFontManager::PrintFont>> aNewFonts; std::vector<std::unique_ptr<PrintFontManager::PrintFont>> aNewFonts;
...@@ -226,26 +221,24 @@ std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::anal ...@@ -226,26 +221,24 @@ std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::anal
if( access( aFullPath.getStr(), R_OK ) ) if( access( aFullPath.getStr(), R_OK ) )
return aNewFonts; return aNewFonts;
fontFormat eFormat = UNKNOWN; bool bSupported = false;
if (pFormat) if (pFormat)
{ {
if (!strcmp(pFormat, "TrueType")) if (!strcmp(pFormat, "TrueType") ||
eFormat = TRUETYPE; !strcmp(pFormat, "CFF"))
else if (!strcmp(pFormat, "CFF")) bSupported = true;
eFormat = CFF;
} }
if (eFormat == UNKNOWN) if (!bSupported)
{ {
OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) );
if( aExt.equalsIgnoreAsciiCase("ttf") if( aExt.equalsIgnoreAsciiCase("ttf")
|| aExt.equalsIgnoreAsciiCase("ttc") || aExt.equalsIgnoreAsciiCase("ttc")
|| aExt.equalsIgnoreAsciiCase("tte") ) // #i33947# for Gaiji support || aExt.equalsIgnoreAsciiCase("tte") // #i33947# for Gaiji support
eFormat = TRUETYPE; || aExt.equalsIgnoreAsciiCase("otf") ) // check for TTF- and PS-OpenType too
else if( aExt.equalsIgnoreAsciiCase("otf") ) // check for TTF- and PS-OpenType too bSupported = true;
eFormat = CFF;
} }
if (eFormat == TRUETYPE || eFormat == CFF) if (bSupported)
{ {
// get number of ttc entries // get number of ttc entries
int nLength = CountTTCFonts( aFullPath.getStr() ); int nLength = CountTTCFonts( aFullPath.getStr() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment