diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2018-04-01 00:00:38 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2018-04-01 00:57:24 +0200 |
commit | 85b9b178467c3dd7a96a6b07713ca94bc3790c50 (patch) | |
tree | 42c33265f0a83bb94f15eabf8164af58d0241d6f /vcl/unx/generic | |
parent | e24f5ba4aab218bd11dbdbadf220458a49e88aff (diff) |
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/52202
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index a66aee353449..97bb6162b3c4 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -207,11 +207,6 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName ) 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>> aNewFonts; @@ -226,26 +221,24 @@ std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::anal if( access( aFullPath.getStr(), R_OK ) ) return aNewFonts; - fontFormat eFormat = UNKNOWN; + bool bSupported = false; if (pFormat) { - if (!strcmp(pFormat, "TrueType")) - eFormat = TRUETYPE; - else if (!strcmp(pFormat, "CFF")) - eFormat = CFF; + if (!strcmp(pFormat, "TrueType") || + !strcmp(pFormat, "CFF")) + bSupported = true; } - if (eFormat == UNKNOWN) + if (!bSupported) { OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); if( aExt.equalsIgnoreAsciiCase("ttf") || aExt.equalsIgnoreAsciiCase("ttc") - || aExt.equalsIgnoreAsciiCase("tte") ) // #i33947# for Gaiji support - eFormat = TRUETYPE; - else if( aExt.equalsIgnoreAsciiCase("otf") ) // check for TTF- and PS-OpenType too - eFormat = CFF; + || aExt.equalsIgnoreAsciiCase("tte") // #i33947# for Gaiji support + || aExt.equalsIgnoreAsciiCase("otf") ) // check for TTF- and PS-OpenType too + bSupported = true; } - if (eFormat == TRUETYPE || eFormat == CFF) + if (bSupported) { // get number of ttc entries int nLength = CountTTCFonts( aFullPath.getStr() ); |