From 374af06be82fde89ca4bd2cbdccb0bc943632ffc Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Sun, 21 Nov 2021 21:31:32 +0300 Subject: [PATCH] Fix build --- DesktopEditor/fontengine/ApplicationFonts.cpp | 14 +++++++------- DesktopEditor/fontengine/ApplicationFonts.h | 4 ++-- DesktopEditor/fontengine/FontFile.cpp | 12 ++++++------ DesktopEditor/fontengine/FontFile.h | 2 +- DesktopEditor/graphics/pro/Fonts.h | 17 +++++++++-------- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/DesktopEditor/fontengine/ApplicationFonts.cpp b/DesktopEditor/fontengine/ApplicationFonts.cpp index 854b7ea56a..9abd391c2b 100644 --- a/DesktopEditor/fontengine/ApplicationFonts.cpp +++ b/DesktopEditor/fontengine/ApplicationFonts.cpp @@ -737,16 +737,16 @@ int CFontList::GetBoldPenalty(INT bCandBold, INT bReqBold) return 0; } -int CFontList::GetFontFormatPenalty(EFontFormat eCandFormat, EFontFormat eReqFormat) +int CFontList::GetFontFormatPenalty(NSFonts::EFontFormat eCandFormat, NSFonts::EFontFormat eReqFormat) { // Вообще, на МSDN написано только про TrueType. Но мы будем сравнивать // все типы форматов и при несовпадении даем вес = 4. Если формат не задан // то по умолчанию считаем его TrueType. - if ( eReqFormat == ffUnknown ) + if ( eReqFormat == NSFonts::fontUnknown ) { // Считаем, что когда формат не известен, значит это 100% не TrueType. - if ( eCandFormat == ffTrueType ) + if ( eCandFormat == NSFonts::fontTrueType ) return 4; else return 0; @@ -827,7 +827,7 @@ int CFontList::GetCapHeightPenalty(SHORT shCandCapHeight, SHORT shReqCapHeight) return abs( shCandCapHeight - shReqCapHeight ) / 20; } -EFontFormat CFontList::GetFontFormat(FT_Face pFace) +NSFonts::EFontFormat CFontList::GetFontFormat(FT_Face pFace) { return CFontFile::GetFontFormatType(pFace); } @@ -1029,7 +1029,7 @@ NSFonts::CFontInfo* CFontList::GetByParams(NSFonts::CFontSelectFormat& oSelect, else if (NULL != oSelect.sFamilyClass) nCurPenalty += GetFamilyUnlikelyPenalty( pInfo->m_sFamilyClass, *oSelect.sFamilyClass ); - //nCurPenalty += GetFontFormatPenalty( pInfo->m_eFontFormat, fontTrueTypeLN ); + //nCurPenalty += GetFontFormatPenalty( pInfo->m_eFontFormat, fontTrueType ); nCurPenalty += GetCharsetPenalty( arrCandRanges, unCharset ); if ( NULL != oSelect.shAvgCharWidth ) @@ -1284,9 +1284,9 @@ void CFontList::LoadFromArrayFiles(std::vector& oArray, int nFlag) } } - EFontFormat eFormat = GetFontFormat( pFace ); + NSFonts::EFontFormat eFormat = GetFontFormat( pFace ); - bool bSupportFont = ((eFormat == ffTrueType) || ((nFlag & 1) && (eFormat == ffOpenType))); + bool bSupportFont = ((eFormat == NSFonts::fontTrueType) || ((nFlag & 1) && (eFormat == NSFonts::fontOpenType))); if (!bSupportFont) { FT_Done_Face( pFace ); diff --git a/DesktopEditor/fontengine/ApplicationFonts.h b/DesktopEditor/fontengine/ApplicationFonts.h index 039771eee8..037f154a64 100644 --- a/DesktopEditor/fontengine/ApplicationFonts.h +++ b/DesktopEditor/fontengine/ApplicationFonts.h @@ -295,7 +295,7 @@ private: int GetWeightPenalty(USHORT usCandWeight, USHORT usReqWeight); int GetItalicPenalty(INT bCandItalic, INT bReqItalic); int GetBoldPenalty(INT bCandBold, INT bReqBold); - int GetFontFormatPenalty(EFontFormat eCandFormat, EFontFormat eReqFormat); + int GetFontFormatPenalty(NSFonts::EFontFormat eCandFormat, NSFonts::EFontFormat eReqFormat); int GetPanosePenalty(BYTE *pCandPanose, BYTE *pReqPanose); int GetAvgWidthPenalty(SHORT shCandWidth, SHORT shReqWidth); int GetAscentPenalty(SHORT shCandAscent, SHORT shReqAscent); @@ -305,7 +305,7 @@ private: int GetCapHeightPenalty(SHORT shCandCapHeight, SHORT shReqCapHeight); public: - static EFontFormat GetFontFormat(FT_Face pFace); + static NSFonts::EFontFormat GetFontFormat(FT_Face pFace); virtual void ToBuffer(BYTE** pDstData, LONG* pLen, NSFonts::CFontListToBufferSerializer& oSerializer); public: diff --git a/DesktopEditor/fontengine/FontFile.cpp b/DesktopEditor/fontengine/FontFile.cpp index 9ffc3750e8..71b72eae72 100644 --- a/DesktopEditor/fontengine/FontFile.cpp +++ b/DesktopEditor/fontengine/FontFile.cpp @@ -1279,21 +1279,21 @@ std::wstring CFontFile::GetFontFormat() const char* sFormat = FT_Get_X11_Font_Format(m_pFace); return NSFile::CUtf8Converter::GetUnicodeFromCharPtr(sFormat, strlen(sFormat)); } -EFontFormat CFontFile::GetFontFormatType(FT_Face pFace) +NSFonts::EFontFormat CFontFile::GetFontFormatType(FT_Face pFace) { if (!pFace) - return fontUnknown; + return NSFonts::fontUnknown; std::string wsFormat( FT_Get_X11_Font_Format( pFace ) ); if ( "Windows FNT" == wsFormat ) - return fontWindowsFNT; + return NSFonts::fontWindowsFNT; else if ( "TrueType" == wsFormat ) - return fontTrueType; + return NSFonts::fontTrueType; else if ( "CFF" == wsFormat ) - return fontOpenType; + return NSFonts::fontOpenType; - return fontUnknown; + return NSFonts::fontUnknown; } unsigned int CFontFile::GetNameIndex(const std::wstring& wsName) const diff --git a/DesktopEditor/fontengine/FontFile.h b/DesktopEditor/fontengine/FontFile.h index ca4c433e67..f5b4a2efb8 100644 --- a/DesktopEditor/fontengine/FontFile.h +++ b/DesktopEditor/fontengine/FontFile.h @@ -321,7 +321,7 @@ public: virtual bool IsSymbolic(bool bIsOS2Check = false); - static EFontFormat GetFontFormatType(FT_Face pFace); + static NSFonts::EFontFormat GetFontFormatType(FT_Face pFace); virtual int GetEmbeddingLicenceType(); virtual void FillFontSelectFormat(NSFonts::CFontSelectFormat& oFormat); }; diff --git a/DesktopEditor/graphics/pro/Fonts.h b/DesktopEditor/graphics/pro/Fonts.h index 78f25b4d10..e726541438 100644 --- a/DesktopEditor/graphics/pro/Fonts.h +++ b/DesktopEditor/graphics/pro/Fonts.h @@ -39,14 +39,6 @@ #include #include "../../common/Types.h" -enum EFontFormat -{ - ffWindowsFNT = 0, // *.fon - ffTrueType = 1, // *.ttf - ffOpenType = 2, // *.ttf, *.otf (CFF формат) - ffUnknown = 3 -}; - struct TBBox { float fMinX; @@ -63,6 +55,7 @@ struct TBBoxAdvance float fAdvanceY; }; + namespace NSBase { class GRAPHICS_DECL CBaseRefCounter @@ -83,6 +76,14 @@ namespace NSBase namespace NSFonts { + enum EFontFormat + { + fontWindowsFNT = 0, // *.fon + fontTrueType = 1, // *.ttf + fontOpenType = 2, // *.ttf, *.otf (CFF формат) + fontUnknown = 3 + }; + class CFontSelectFormat { public: