Fix build

This commit is contained in:
Oleg Korshul
2021-11-21 21:31:32 +03:00
parent 8b42268d7e
commit 374af06be8
5 changed files with 25 additions and 24 deletions

View File

@ -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<std::wstring>& 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 );

View File

@ -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:

View File

@ -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

View File

@ -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);
};

View File

@ -39,14 +39,6 @@
#include <vector>
#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: