[Libreoffice-commits] core.git: vcl/unx
Khaled Hosny
khaledhosny at eglug.org
Sat Mar 31 22:57:45 UTC 2018
vcl/unx/generic/fontmanager/fontmanager.cxx | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
New commits:
commit 85b9b178467c3dd7a96a6b07713ca94bc3790c50
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Sun Apr 1 00:00:38 2018 +0200
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 at libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
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() );
More information about the Libreoffice-commits
mailing list