diff options
-rw-r--r-- | core/fxge/apple/apple_int.h | 4 | ||||
-rw-r--r-- | core/fxge/apple/fx_mac_imp.cpp | 15 | ||||
-rw-r--r-- | core/fxge/apple/fx_quartz_device.cpp | 10 | ||||
-rw-r--r-- | core/fxge/include/fx_ge_apple.h | 6 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 21 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.h | 13 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 48 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.h | 10 |
8 files changed, 104 insertions, 23 deletions
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index 5a3c0756db..c19282b12b 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -134,9 +134,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { const CFX_Matrix* pMatrix, uint32_t flags, void*& handle, - int blend_type) override { - return FALSE; - } + int blend_type) override; FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index a0f2acb370..528b7274db 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -25,15 +25,18 @@ static const struct { {"Times-BoldItalic", "Times New Roman Bold Italic"}, {"Times-Italic", "Times New Roman Italic"}, }; + class CFX_MacFontInfo : public CFX_FolderFontInfo { public: - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* family, - int& iExact); + // CFX_FolderFontInfo + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* family, + int& iExact) override; }; + #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" #define JAPAN_MINCHO "Hiragino Mincho Pro W6" static void GetJapanesePreference(CFX_ByteString& face, diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index 4e1e62d6eb..8adf6326c1 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -731,6 +731,16 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, return TRUE; } +FX_BOOL CFX_QuartzDeviceDriver::StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t flags, + void*& handle, + int blend_type) { + return FALSE; +} + FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlyphRun( int nChars, const FXTEXT_CHARPOS* pCharPos, diff --git a/core/fxge/include/fx_ge_apple.h b/core/fxge/include/fx_ge_apple.h index 57acef653c..6dce86697f 100644 --- a/core/fxge/include/fx_ge_apple.h +++ b/core/fxge/include/fx_ge_apple.h @@ -8,10 +8,14 @@ #define CORE_FXGE_INCLUDE_FX_GE_APPLE_H_ #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ + +#include "core/fxge/include/fx_ge.h" + class CFX_QuartzDevice : public CFX_RenderDevice { public: CFX_QuartzDevice(); - ~CFX_QuartzDevice(); + ~CFX_QuartzDevice() override; + FX_BOOL Attach(CGContextRef context, int32_t nDeviceClass = FXDC_DISPLAY); FX_BOOL Attach(CFX_DIBitmap* pBitmap); FX_BOOL Create(int32_t width, int32_t height, FXDIB_Format format); diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index c82b7f3091..f253b06c6d 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -759,6 +759,15 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( return TRUE; } +FX_BOOL CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int blend_type) { + return FALSE; +} + FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, uint32_t fill_color, int blend_type) { @@ -907,6 +916,10 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, return true; } +uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const { + return m_pBitmap->GetBuffer(); +} + FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead pRect->left = 0; @@ -953,6 +966,10 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, return bRet; } +CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { + return m_pOriDevice; +} + FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, uint32_t argb, const FX_RECT* pSrcRect, @@ -1086,6 +1103,10 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, return TRUE; } +FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { + return FALSE; +} + void CFX_SkiaDeviceDriver::PreMultiply() { void* buffer = m_pBitmap->GetBuffer(); if (!buffer) diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index 15f6306cb0..5ad66f79b3 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -64,16 +64,14 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT x2, FX_FLOAT y2, uint32_t color, - int blend_type) override { - return FALSE; - } + int blend_type) override; FX_BOOL GetClipBox(FX_RECT* pRect) override; /** Load device buffer into a DIB */ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; - CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; } + CFX_DIBitmap* GetBackDrop() override; FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, uint32_t color, @@ -99,9 +97,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { void*& handle, int blend_type) override; - FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override { - return FALSE; - } + FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override; void CancelDIBits(void* handle) override {} @@ -119,7 +115,8 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { int alpha, FX_BOOL bAlphaMode) override; - virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } + virtual uint8_t* GetBuffer() const; + void PaintStroke(SkPaint* spaint, const CFX_GraphStateData* pGraphState, const SkMatrix& matrix); diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index fc839e9209..00b1028a76 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -13,9 +13,11 @@ #include "xfa/fgas/font/fgas_gefont.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + IFGAS_FontMgr* IFGAS_FontMgr::Create(FX_LPEnumAllFonts pEnumerator) { return new CFGAS_StdFontMgrImp(pEnumerator); } + CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) : m_pEnumerator(pEnumerator), m_FontFaces(), @@ -74,6 +76,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( } return NULL; } + CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, @@ -128,6 +131,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByLanguage( return GetDefFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), dwFontStyles, pszFontFamily); } + CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { @@ -159,6 +163,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, } return NULL; } + CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { ASSERT(pBuffer && iLength > 0); @@ -207,6 +212,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, } return NULL; } + CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage) { @@ -258,6 +264,7 @@ void CFGAS_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, break; } } + void CFGAS_StdFontMgrImp::RemoveFont(CFGAS_GEFont* pFont) { RemoveFont(m_CPFonts, pFont); RemoveFont(m_FamilyFonts, pFont); @@ -270,6 +277,7 @@ void CFGAS_StdFontMgrImp::RemoveFont(CFGAS_GEFont* pFont) { m_Fonts.RemoveAt(iFind, 1); } } + FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont( const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, @@ -308,6 +316,7 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont( } return NULL; } + FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors& fonts) { FX_FONTDESCRIPTOR const* pBestFont = NULL; @@ -363,6 +372,7 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, } return iBestSimilar < 1 ? NULL : pBestFont; } + int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, uint32_t dwFontStyles) { int32_t iValue = 0; @@ -384,9 +394,11 @@ int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, } return iValue; } + FX_LPMatchFont FX_GetDefFontMatchor() { return FX_DefFontMatcher; } + uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf) { uint32_t dwStyles = 0; if ((lf.lfPitchAndFamily & 0x03) == FIXED_PITCH) { @@ -404,6 +416,7 @@ uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf) { } return dwStyles; } + static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe, NEWTEXTMETRICEX* lpntme, DWORD dwFontType, @@ -427,6 +440,7 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe, FX_Free(pFont); return 1; } + static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, const FX_WCHAR* pwsFaceName, FX_WCHAR wUnicode) { @@ -442,9 +456,11 @@ static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, (FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0); ::ReleaseDC(NULL, hDC); } + FX_LPEnumAllFonts FX_GetDefFontEnumerator() { return FX_EnumGdiFonts; } + #else const FX_CHAR* g_FontFolders[] = { #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ @@ -457,11 +473,18 @@ const FX_CHAR* g_FontFolders[] = { #endif }; +CFX_FontDescriptor::CFX_FontDescriptor() + : m_nFaceIndex(0), m_dwFontStyles(0), m_dwUsb(), m_dwCsb() {} + +CFX_FontDescriptor::~CFX_FontDescriptor() {} + CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i) m_FolderPaths.Add(g_FontFolders[i]); } +CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} + CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { Restart: void* pCurHandle = @@ -522,6 +545,7 @@ Restart: } return bsName; } + FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { m_wsNext = GetNextFile().UTF8Decode(); if (0 == m_wsNext.GetLength()) { @@ -600,11 +624,13 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { return FALSE; return TRUE; } + FX_BOOL CFGAS_FontMgrImp::EnumFonts() { if (EnumFontsFromFontMapper()) return TRUE; return EnumFontsFromFiles(); } + void CFGAS_FontMgrImp::Release() { for (int32_t i = 0; i < m_InstalledFonts.GetSize(); i++) { delete m_InstalledFonts[i]; @@ -633,24 +659,28 @@ void CFGAS_FontMgrImp::Release() { } delete this; } + CFGAS_GEFont* CFGAS_FontMgrImp::GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { return nullptr; } + CFGAS_GEFont* CFGAS_FontMgrImp::GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { return nullptr; } + CFGAS_GEFont* CFGAS_FontMgrImp::GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { return nullptr; } + CFGAS_GEFont* CFGAS_FontMgrImp::GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, @@ -698,6 +728,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByCodePage( pFonts->Add(pFont); return pFont; } + CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, @@ -705,6 +736,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByCharset( return GetFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, pszFontFamily); } + CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, @@ -756,6 +788,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( m_FailedUnicodes2NULL.SetAt(wUnicode, nullptr); return nullptr; } + FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode) { IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); @@ -933,6 +966,7 @@ IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream( } return nullptr; } + int32_t CFGAS_FontMgrImp::MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, @@ -1078,6 +1112,7 @@ int32_t CFGAS_FontMgrImp::CalcPenalty(CFX_FontDescriptor* pInstalled, } return nPenalty; } + void CFGAS_FontMgrImp::ClearFontCache() { FX_POSITION pos = m_Hash2CandidateList.GetStartPosition(); while (pos) { @@ -1094,6 +1129,7 @@ void CFGAS_FontMgrImp::ClearFontCache() { pFileRead->Release(); } } + void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { if (NULL == pEFont) { return; @@ -1180,6 +1216,7 @@ void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream, FXFT_Done_Face(pFace); } while (index < num_faces); } + uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) { uint32_t flag = 0; if (FT_IS_FIXED_WIDTH(pFace)) { @@ -1200,10 +1237,12 @@ uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) { } return flag; } + #define GetUInt8(p) ((uint8_t)((p)[0])) #define GetUInt16(p) ((uint16_t)((p)[0] << 8 | (p)[1])) #define GetUInt32(p) \ ((uint32_t)((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3])) + void CFGAS_FontMgrImp::GetNames(const uint8_t* name_table, CFX_WideStringArray& Names) { if (NULL == name_table) { @@ -1246,6 +1285,7 @@ struct FX_BIT2CHARSET { uint16_t wBit; uint16_t wCharset; }; + FX_BIT2CHARSET g_FX_Bit2Charset1[16] = { {1 << 0, FX_CHARSET_ANSI}, {1 << 1, FX_CHARSET_MSWin_EasterEuropean}, @@ -1264,6 +1304,7 @@ FX_BIT2CHARSET g_FX_Bit2Charset1[16] = { {1 << 14, FX_CHARSET_Default}, {1 << 15, FX_CHARSET_Default}, }; + FX_BIT2CHARSET g_FX_Bit2Charset2[16] = { {1 << 0, FX_CHARSET_Thai}, {1 << 1, FX_CHARSET_ShiftJIS}, @@ -1282,6 +1323,7 @@ FX_BIT2CHARSET g_FX_Bit2Charset2[16] = { {1 << 14, FX_CHARSET_OEM}, {1 << 15, FX_CHARSET_Symbol}, }; + FX_BIT2CHARSET g_FX_Bit2Charset3[16] = { {1 << 0, FX_CHARSET_Default}, {1 << 1, FX_CHARSET_Default}, {1 << 2, FX_CHARSET_Default}, {1 << 3, FX_CHARSET_Default}, @@ -1292,6 +1334,7 @@ FX_BIT2CHARSET g_FX_Bit2Charset3[16] = { {1 << 12, FX_CHARSET_Default}, {1 << 13, FX_CHARSET_Default}, {1 << 14, FX_CHARSET_Default}, {1 << 15, FX_CHARSET_Default}, }; + FX_BIT2CHARSET g_FX_Bit2Charset4[16] = { {1 << 0, FX_CHARSET_Default}, {1 << 1, FX_CHARSET_Default}, {1 << 2, FX_CHARSET_Default}, {1 << 3, FX_CHARSET_Default}, @@ -1302,12 +1345,14 @@ FX_BIT2CHARSET g_FX_Bit2Charset4[16] = { {1 << 12, FX_CHARSET_Default}, {1 << 13, FX_CHARSET_Default}, {1 << 14, FX_CHARSET_Default}, {1 << 15, FX_CHARSET_US}, }; + #define CODEPAGERANGE_IMPLEMENT(n) \ for (int32_t i = 0; i < 16; i++) { \ if ((a##n & g_FX_Bit2Charset##n[i].wBit) != 0) { \ Charsets.Add(g_FX_Bit2Charset##n[i].wCharset); \ } \ } + void CFGAS_FontMgrImp::GetCharsets(FXFT_Face pFace, CFX_ArrayTemplate<uint16_t>& Charsets) { Charsets.RemoveAll(); @@ -1326,6 +1371,7 @@ void CFGAS_FontMgrImp::GetCharsets(FXFT_Face pFace, Charsets.Add(FX_CHARSET_Default); } } + #undef CODEPAGERANGE_IMPLEMENT void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace, uint32_t* USB, @@ -1347,6 +1393,7 @@ void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace, CSB[1] = 0; } } + int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2) { if (Name1.Find(Name2.c_str()) != -1) { @@ -1354,4 +1401,5 @@ int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, } return 0; } + #endif diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index 11d91fc7f5..66b1412d10 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -82,11 +82,8 @@ uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf); class CFX_FontDescriptor { public: - CFX_FontDescriptor() : m_nFaceIndex(0), m_dwFontStyles(0) { - m_dwUsb[0] = m_dwUsb[1] = m_dwUsb[2] = m_dwUsb[3] = 0; - m_dwCsb[0] = m_dwCsb[1] = 0; - } - ~CFX_FontDescriptor() {} + CFX_FontDescriptor(); + ~CFX_FontDescriptor(); int32_t m_nFaceIndex; CFX_WideString m_wsFaceName; @@ -95,6 +92,7 @@ class CFX_FontDescriptor { uint32_t m_dwUsb[4]; uint32_t m_dwCsb[2]; }; + typedef CFX_ArrayTemplate<CFX_FontDescriptor*> CFX_FontDescriptors; struct FX_FontDescriptorInfo { @@ -112,6 +110,7 @@ struct FX_FontDescriptorInfo { return nPenalty == other.nPenalty; } }; + typedef CFX_ArrayTemplate<FX_FontDescriptorInfo> CFX_FontDescriptorInfos; struct FX_HandleParentPath { @@ -127,6 +126,7 @@ struct FX_HandleParentPath { class CFX_FontSourceEnum_File { public: CFX_FontSourceEnum_File(); + ~CFX_FontSourceEnum_File(); void Release() { delete this; } FX_POSITION GetStartPosition(); |