From 17f382a50a7c4e5b6f14f76027a15de4ac17bc4c Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 12 Apr 2016 16:55:56 -0700 Subject: Cleanup various IFX_ text interfaces. This CL removes IFX_ArabicChar, IFX_RTFBreak, IFX_TxtBreak, IFX_WordBreak, IFX_FormatString, and IFX_GSUBTable. References were updated to be the concrete classes. The CFX_GSUBTable was also removed as it is unused. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1882213002 --- core/fpdfapi/fpdf_font/ttgsubtable.cpp | 31 ----- core/fpdfapi/fpdf_font/ttgsubtable.h | 8 +- core/fxcrt/fx_arabic.cpp | 9 +- core/fxcrt/fx_arabic.h | 211 --------------------------------- core/fxcrt/include/fx_arabic.h | 195 ++++++++++++++++++++++++++++++ core/fxcrt/include/fx_arb.h | 17 --- core/fxge/include/fx_font.h | 9 -- 7 files changed, 199 insertions(+), 281 deletions(-) delete mode 100644 core/fxcrt/fx_arabic.h create mode 100644 core/fxcrt/include/fx_arabic.h (limited to 'core') diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp index 321419346d..f6d6400f47 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -382,34 +382,3 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, rec->Substitute[i] = GetUInt16(sp); } } -FX_BOOL CFX_GSUBTable::GetVerticalGlyph(uint32_t glyphnum, - uint32_t* vglyphnum) { - return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum); -} -// static -IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { - if (!pFont) { - return NULL; - } - if (!pFont->GetSubData()) { - unsigned long length = 0; - int error = FXFT_Load_Sfnt_Table( - pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length); - if (!error) { - pFont->SetSubData(FX_Alloc(uint8_t, length)); - } - if (!pFont->GetSubData()) { - return NULL; - } - } - int error = - FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, - pFont->GetSubData(), NULL); - if (!error && pFont->GetSubData()) { - std::unique_ptr pGsubTable(new CFX_GSUBTable); - if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { - return pGsubTable.release(); - } - } - return NULL; -} diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h index 7a6c66cc2a..0ef2351336 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/fpdfapi/fpdf_font/ttgsubtable.h @@ -25,6 +25,7 @@ class CFX_GlyphMap { protected: CFX_BinaryBuf m_Buffer; }; + class CFX_CTTGSUBTable { public: CFX_CTTGSUBTable(void) : m_bFeautureMapLoad(FALSE), loaded(false) {} @@ -352,12 +353,5 @@ class CFX_CTTGSUBTable { struct TFeatureList FeatureList; struct TLookupList LookupList; }; -class CFX_GSUBTable final : public IFX_GSUBTable { - public: - ~CFX_GSUBTable() override {} - FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) override; - - CFX_CTTGSUBTable m_GsubImp; -}; #endif // CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 95fa8f52a0..803683782d 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxcrt/fx_arabic.h" +#include "core/fxcrt/include/fx_arabic.h" #include "core/fxcrt/include/fx_ucd.h" namespace { @@ -145,9 +145,6 @@ FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { return shadda; } -IFX_ArabicChar* IFX_ArabicChar::Create() { - return new CFX_ArabicChar; -} FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { uint32_t dwRet = kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK; @@ -438,10 +435,10 @@ const int32_t gc_FX_BidiNeutralStates[][5] = { }; const int32_t gc_FX_BidiNeutralActions[][5] = { {FX_BNAIn, 0, 0, 0, 0}, - {FX_BNAIn, 0, 0, 0, FX_BCL}, + {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L}, {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNARn}, {FX_BNAIn, FX_BNALn, FX_BNAEn, FX_BNAEn, FX_BNALnL}, - {FX_BNAIn, 0, 0, 0, FX_BCL}, + {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L}, {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNAEn}, }; int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) { diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/fx_arabic.h deleted file mode 100644 index 694bc51020..0000000000 --- a/core/fxcrt/fx_arabic.h +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXCRT_FX_ARABIC_H_ -#define CORE_FXCRT_FX_ARABIC_H_ - -#include "core/fxcrt/include/fx_arb.h" - -class CFX_ArabicChar : public IFX_ArabicChar { - public: - virtual void Release() { delete this; } - virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const; - virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const; - - virtual FX_WCHAR GetFormChar(FX_WCHAR wch, - FX_WCHAR prev = 0, - FX_WCHAR next = 0) const; - virtual FX_WCHAR GetFormChar(const CFX_Char* cur, - const CFX_Char* prev, - const CFX_Char* next) const; - - protected: - const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, - FX_WCHAR& wChar, - FX_CHARTYPE& eType) const; -}; -void FX_BidiReverseString(CFX_WideString& wsText, - int32_t iStart, - int32_t iCount); -void FX_BidiSetDeferredRun(CFX_Int32Array& values, - int32_t iStart, - int32_t iCount, - int32_t iValue); -#define FX_BCON FX_BIDICLASS_ON -#define FX_BCL FX_BIDICLASS_L -#define FX_BCR FX_BIDICLASS_R -#define FX_BCAN FX_BIDICLASS_AN -#define FX_BCEN FX_BIDICLASS_EN -#define FX_BCAL FX_BIDICLASS_AL -#define FX_BCNSM FX_BIDICLASS_NSM -#define FX_BCCS FX_BIDICLASS_CS -#define FX_BCES FX_BIDICLASS_ES -#define FX_BCET FX_BIDICLASS_ET -#define FX_BCBN FX_BIDICLASS_BN -#define FX_BCS FX_BIDICLASS_S -#define FX_BCWS FX_BIDICLASS_WS -#define FX_BCB FX_BIDICLASS_B -#define FX_BCRLO FX_BIDICLASS_RLO -#define FX_BCRLE FX_BIDICLASS_RLE -#define FX_BCLRO FX_BIDICLASS_LRO -#define FX_BCLRE FX_BIDICLASS_LRE -#define FX_BCPDF FX_BIDICLASS_PDF -#define FX_BCN FX_BIDICLASS_N -void FX_BidiClassify(const CFX_WideString& wsText, - CFX_Int32Array& classes, - FX_BOOL bWS = FALSE); -#define FX_BIDIMAXLEVEL 61 -#define FX_BidiGreaterEven(a) (FX_IsOdd(a) ? ((a) + 1) : ((a) + 2)) -#define FX_BidiGreaterOdd(a) (FX_IsOdd(a) ? ((a) + 2) : ((a) + 1)) -int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, - int32_t iDirection, - CFX_Int32Array& classes, - CFX_Int32Array& levels, - int32_t iStart, - int32_t iCount, - int32_t iNest = 0); -#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L) -enum FX_BIDIWEAKSTATE { - FX_BIDIWEAKSTATE_xa = 0, - FX_BIDIWEAKSTATE_xr, - FX_BIDIWEAKSTATE_xl, - FX_BIDIWEAKSTATE_ao, - FX_BIDIWEAKSTATE_ro, - FX_BIDIWEAKSTATE_lo, - FX_BIDIWEAKSTATE_rt, - FX_BIDIWEAKSTATE_lt, - FX_BIDIWEAKSTATE_cn, - FX_BIDIWEAKSTATE_ra, - FX_BIDIWEAKSTATE_re, - FX_BIDIWEAKSTATE_la, - FX_BIDIWEAKSTATE_le, - FX_BIDIWEAKSTATE_ac, - FX_BIDIWEAKSTATE_rc, - FX_BIDIWEAKSTATE_rs, - FX_BIDIWEAKSTATE_lc, - FX_BIDIWEAKSTATE_ls, - FX_BIDIWEAKSTATE_ret, - FX_BIDIWEAKSTATE_let, -}; -#define FX_BWSxa FX_BIDIWEAKSTATE_xa -#define FX_BWSxr FX_BIDIWEAKSTATE_xr -#define FX_BWSxl FX_BIDIWEAKSTATE_xl -#define FX_BWSao FX_BIDIWEAKSTATE_ao -#define FX_BWSro FX_BIDIWEAKSTATE_ro -#define FX_BWSlo FX_BIDIWEAKSTATE_lo -#define FX_BWSrt FX_BIDIWEAKSTATE_rt -#define FX_BWSlt FX_BIDIWEAKSTATE_lt -#define FX_BWScn FX_BIDIWEAKSTATE_cn -#define FX_BWSra FX_BIDIWEAKSTATE_ra -#define FX_BWSre FX_BIDIWEAKSTATE_re -#define FX_BWSla FX_BIDIWEAKSTATE_la -#define FX_BWSle FX_BIDIWEAKSTATE_le -#define FX_BWSac FX_BIDIWEAKSTATE_ac -#define FX_BWSrc FX_BIDIWEAKSTATE_rc -#define FX_BWSrs FX_BIDIWEAKSTATE_rs -#define FX_BWSlc FX_BIDIWEAKSTATE_lc -#define FX_BWSls FX_BIDIWEAKSTATE_ls -#define FX_BWSret FX_BIDIWEAKSTATE_ret -#define FX_BWSlet FX_BIDIWEAKSTATE_let -enum FX_BIDIWEAKACTION { - FX_BIDIWEAKACTION_IX = 0x100, - FX_BIDIWEAKACTION_XX = 0x0F, - FX_BIDIWEAKACTION_xxx = (0x0F << 4) + 0x0F, - FX_BIDIWEAKACTION_xIx = 0x100 + FX_BIDIWEAKACTION_xxx, - FX_BIDIWEAKACTION_xxN = (0x0F << 4) + FX_BIDICLASS_ON, - FX_BIDIWEAKACTION_xxE = (0x0F << 4) + FX_BIDICLASS_EN, - FX_BIDIWEAKACTION_xxA = (0x0F << 4) + FX_BIDICLASS_AN, - FX_BIDIWEAKACTION_xxR = (0x0F << 4) + FX_BIDICLASS_R, - FX_BIDIWEAKACTION_xxL = (0x0F << 4) + FX_BIDICLASS_L, - FX_BIDIWEAKACTION_Nxx = (FX_BIDICLASS_ON << 4) + 0x0F, - FX_BIDIWEAKACTION_Axx = (FX_BIDICLASS_AN << 4) + 0x0F, - FX_BIDIWEAKACTION_ExE = (FX_BIDICLASS_EN << 4) + FX_BIDICLASS_EN, - FX_BIDIWEAKACTION_NIx = (FX_BIDICLASS_ON << 4) + 0x0F + 0x100, - FX_BIDIWEAKACTION_NxN = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_ON, - FX_BIDIWEAKACTION_NxR = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_R, - FX_BIDIWEAKACTION_NxE = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_EN, - FX_BIDIWEAKACTION_AxA = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_AN, - FX_BIDIWEAKACTION_NxL = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_L, - FX_BIDIWEAKACTION_LxL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, - FX_BIDIWEAKACTION_xIL = (0x0F << 4) + FX_BIDICLASS_L + 0x100, - FX_BIDIWEAKACTION_AxR = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_R, - FX_BIDIWEAKACTION_Lxx = (FX_BIDICLASS_L << 4) + 0x0F, -}; -#define FX_BWAIX FX_BIDIWEAKACTION_IX -#define FX_BWAXX FX_BIDIWEAKACTION_XX -#define FX_BWAxxx FX_BIDIWEAKACTION_xxx -#define FX_BWAxIx FX_BIDIWEAKACTION_xIx -#define FX_BWAxxN FX_BIDIWEAKACTION_xxN -#define FX_BWAxxE FX_BIDIWEAKACTION_xxE -#define FX_BWAxxA FX_BIDIWEAKACTION_xxA -#define FX_BWAxxR FX_BIDIWEAKACTION_xxR -#define FX_BWAxxL FX_BIDIWEAKACTION_xxL -#define FX_BWANxx FX_BIDIWEAKACTION_Nxx -#define FX_BWAAxx FX_BIDIWEAKACTION_Axx -#define FX_BWAExE FX_BIDIWEAKACTION_ExE -#define FX_BWANIx FX_BIDIWEAKACTION_NIx -#define FX_BWANxN FX_BIDIWEAKACTION_NxN -#define FX_BWANxR FX_BIDIWEAKACTION_NxR -#define FX_BWANxE FX_BIDIWEAKACTION_NxE -#define FX_BWAAxA FX_BIDIWEAKACTION_AxA -#define FX_BWANxL FX_BIDIWEAKACTION_NxL -#define FX_BWALxL FX_BIDIWEAKACTION_LxL -#define FX_BWAxIL FX_BIDIWEAKACTION_xIL -#define FX_BWAAxR FX_BIDIWEAKACTION_AxR -#define FX_BWALxx FX_BIDIWEAKACTION_Lxx -#define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F) -#define FX_BidiGetResolvedType(a) ((a)&0x0F) -void FX_BidiResolveWeak(int32_t iBaseLevel, - CFX_Int32Array& classes, - CFX_Int32Array& levels); -enum FX_BIDINEUTRALSTATE { - FX_BIDINEUTRALSTATE_r = 0, - FX_BIDINEUTRALSTATE_l, - FX_BIDINEUTRALSTATE_rn, - FX_BIDINEUTRALSTATE_ln, - FX_BIDINEUTRALSTATE_a, - FX_BIDINEUTRALSTATE_na, -}; -#define FX_BNSr FX_BIDINEUTRALSTATE_r -#define FX_BNSl FX_BIDINEUTRALSTATE_l -#define FX_BNSrn FX_BIDINEUTRALSTATE_rn -#define FX_BNSln FX_BIDINEUTRALSTATE_ln -#define FX_BNSa FX_BIDINEUTRALSTATE_a -#define FX_BNSna FX_BIDINEUTRALSTATE_na -enum FX_BIDINEUTRALACTION { - FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L, - FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4), - FX_BIDINEUTRALACTION_Rn = (FX_BIDICLASS_R << 4), - FX_BIDINEUTRALACTION_Ln = (FX_BIDICLASS_L << 4), - FX_BIDINEUTRALACTION_In = FX_BIDIWEAKACTION_IX, - FX_BIDINEUTRALACTION_LnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, -}; -#define FX_BNAnL FX_BIDINEUTRALACTION_nL -#define FX_BNAEn FX_BIDINEUTRALACTION_En -#define FX_BNARn FX_BIDINEUTRALACTION_Rn -#define FX_BNALn FX_BIDINEUTRALACTION_Ln -#define FX_BNAIn FX_BIDINEUTRALACTION_In -#define FX_BNALnL FX_BIDINEUTRALACTION_LnL -int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel); -int32_t FX_BidiGetResolvedNeutrals(int32_t iAction); -void FX_BidiResolveNeutrals(int32_t iBaseLevel, - CFX_Int32Array& classes, - const CFX_Int32Array& levels); -void FX_BidiResolveImplicit(const CFX_Int32Array& classes, - CFX_Int32Array& levels); -void FX_BidiResolveWhitespace(int32_t iBaseLevel, - const CFX_Int32Array& classes, - CFX_Int32Array& levels); -int32_t FX_BidiReorderLevel(int32_t iBaseLevel, - CFX_WideString& wsText, - const CFX_Int32Array& levels, - int32_t iStart, - FX_BOOL bReverse = FALSE); -void FX_BidiReorder(int32_t iBaseLevel, - CFX_WideString& wsText, - const CFX_Int32Array& levels); - -#endif // CORE_FXCRT_FX_ARABIC_H_ diff --git a/core/fxcrt/include/fx_arabic.h b/core/fxcrt/include/fx_arabic.h new file mode 100644 index 0000000000..96fa7954c3 --- /dev/null +++ b/core/fxcrt/include/fx_arabic.h @@ -0,0 +1,195 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXCRT_INCLUDE_FX_ARABIC_H_ +#define CORE_FXCRT_INCLUDE_FX_ARABIC_H_ + +#include "core/fxcrt/include/fx_arb.h" + +#define FX_BIDIMAXLEVEL 61 +#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L) +#define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F) +#define FX_BidiGetResolvedType(a) ((a)&0x0F) + +class CFX_ArabicChar { + public: + void Release() { delete this; } + + FX_BOOL IsArabicChar(FX_WCHAR wch) const; + FX_BOOL IsArabicFormChar(FX_WCHAR wch) const; + + FX_WCHAR GetFormChar(FX_WCHAR wch, + FX_WCHAR prev = 0, + FX_WCHAR next = 0) const; + FX_WCHAR GetFormChar(const CFX_Char* cur, + const CFX_Char* prev, + const CFX_Char* next) const; + + protected: + const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC, + FX_WCHAR& wChar, + FX_CHARTYPE& eType) const; +}; + +void FX_BidiReverseString(CFX_WideString& wsText, + int32_t iStart, + int32_t iCount); +void FX_BidiSetDeferredRun(CFX_Int32Array& values, + int32_t iStart, + int32_t iCount, + int32_t iValue); +void FX_BidiClassify(const CFX_WideString& wsText, + CFX_Int32Array& classes, + FX_BOOL bWS = FALSE); +int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, + int32_t iDirection, + CFX_Int32Array& classes, + CFX_Int32Array& levels, + int32_t iStart, + int32_t iCount, + int32_t iNest = 0); + +enum FX_BIDIWEAKSTATE { + FX_BIDIWEAKSTATE_xa = 0, + FX_BIDIWEAKSTATE_xr, + FX_BIDIWEAKSTATE_xl, + FX_BIDIWEAKSTATE_ao, + FX_BIDIWEAKSTATE_ro, + FX_BIDIWEAKSTATE_lo, + FX_BIDIWEAKSTATE_rt, + FX_BIDIWEAKSTATE_lt, + FX_BIDIWEAKSTATE_cn, + FX_BIDIWEAKSTATE_ra, + FX_BIDIWEAKSTATE_re, + FX_BIDIWEAKSTATE_la, + FX_BIDIWEAKSTATE_le, + FX_BIDIWEAKSTATE_ac, + FX_BIDIWEAKSTATE_rc, + FX_BIDIWEAKSTATE_rs, + FX_BIDIWEAKSTATE_lc, + FX_BIDIWEAKSTATE_ls, + FX_BIDIWEAKSTATE_ret, + FX_BIDIWEAKSTATE_let, +}; +#define FX_BWSxa FX_BIDIWEAKSTATE_xa +#define FX_BWSxr FX_BIDIWEAKSTATE_xr +#define FX_BWSxl FX_BIDIWEAKSTATE_xl +#define FX_BWSao FX_BIDIWEAKSTATE_ao +#define FX_BWSro FX_BIDIWEAKSTATE_ro +#define FX_BWSlo FX_BIDIWEAKSTATE_lo +#define FX_BWSrt FX_BIDIWEAKSTATE_rt +#define FX_BWSlt FX_BIDIWEAKSTATE_lt +#define FX_BWScn FX_BIDIWEAKSTATE_cn +#define FX_BWSra FX_BIDIWEAKSTATE_ra +#define FX_BWSre FX_BIDIWEAKSTATE_re +#define FX_BWSla FX_BIDIWEAKSTATE_la +#define FX_BWSle FX_BIDIWEAKSTATE_le +#define FX_BWSac FX_BIDIWEAKSTATE_ac +#define FX_BWSrc FX_BIDIWEAKSTATE_rc +#define FX_BWSrs FX_BIDIWEAKSTATE_rs +#define FX_BWSlc FX_BIDIWEAKSTATE_lc +#define FX_BWSls FX_BIDIWEAKSTATE_ls +#define FX_BWSret FX_BIDIWEAKSTATE_ret +#define FX_BWSlet FX_BIDIWEAKSTATE_let + +enum FX_BIDIWEAKACTION { + FX_BIDIWEAKACTION_IX = 0x100, + FX_BIDIWEAKACTION_XX = 0x0F, + FX_BIDIWEAKACTION_xxx = (0x0F << 4) + 0x0F, + FX_BIDIWEAKACTION_xIx = 0x100 + FX_BIDIWEAKACTION_xxx, + FX_BIDIWEAKACTION_xxN = (0x0F << 4) + FX_BIDICLASS_ON, + FX_BIDIWEAKACTION_xxE = (0x0F << 4) + FX_BIDICLASS_EN, + FX_BIDIWEAKACTION_xxA = (0x0F << 4) + FX_BIDICLASS_AN, + FX_BIDIWEAKACTION_xxR = (0x0F << 4) + FX_BIDICLASS_R, + FX_BIDIWEAKACTION_xxL = (0x0F << 4) + FX_BIDICLASS_L, + FX_BIDIWEAKACTION_Nxx = (FX_BIDICLASS_ON << 4) + 0x0F, + FX_BIDIWEAKACTION_Axx = (FX_BIDICLASS_AN << 4) + 0x0F, + FX_BIDIWEAKACTION_ExE = (FX_BIDICLASS_EN << 4) + FX_BIDICLASS_EN, + FX_BIDIWEAKACTION_NIx = (FX_BIDICLASS_ON << 4) + 0x0F + 0x100, + FX_BIDIWEAKACTION_NxN = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_ON, + FX_BIDIWEAKACTION_NxR = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_R, + FX_BIDIWEAKACTION_NxE = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_EN, + FX_BIDIWEAKACTION_AxA = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_AN, + FX_BIDIWEAKACTION_NxL = (FX_BIDICLASS_ON << 4) + FX_BIDICLASS_L, + FX_BIDIWEAKACTION_LxL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, + FX_BIDIWEAKACTION_xIL = (0x0F << 4) + FX_BIDICLASS_L + 0x100, + FX_BIDIWEAKACTION_AxR = (FX_BIDICLASS_AN << 4) + FX_BIDICLASS_R, + FX_BIDIWEAKACTION_Lxx = (FX_BIDICLASS_L << 4) + 0x0F, +}; +#define FX_BWAIX FX_BIDIWEAKACTION_IX +#define FX_BWAXX FX_BIDIWEAKACTION_XX +#define FX_BWAxxx FX_BIDIWEAKACTION_xxx +#define FX_BWAxIx FX_BIDIWEAKACTION_xIx +#define FX_BWAxxN FX_BIDIWEAKACTION_xxN +#define FX_BWAxxE FX_BIDIWEAKACTION_xxE +#define FX_BWAxxA FX_BIDIWEAKACTION_xxA +#define FX_BWAxxR FX_BIDIWEAKACTION_xxR +#define FX_BWAxxL FX_BIDIWEAKACTION_xxL +#define FX_BWANxx FX_BIDIWEAKACTION_Nxx +#define FX_BWAAxx FX_BIDIWEAKACTION_Axx +#define FX_BWAExE FX_BIDIWEAKACTION_ExE +#define FX_BWANIx FX_BIDIWEAKACTION_NIx +#define FX_BWANxN FX_BIDIWEAKACTION_NxN +#define FX_BWANxR FX_BIDIWEAKACTION_NxR +#define FX_BWANxE FX_BIDIWEAKACTION_NxE +#define FX_BWAAxA FX_BIDIWEAKACTION_AxA +#define FX_BWANxL FX_BIDIWEAKACTION_NxL +#define FX_BWALxL FX_BIDIWEAKACTION_LxL +#define FX_BWAxIL FX_BIDIWEAKACTION_xIL +#define FX_BWAAxR FX_BIDIWEAKACTION_AxR +#define FX_BWALxx FX_BIDIWEAKACTION_Lxx + +void FX_BidiResolveWeak(int32_t iBaseLevel, + CFX_Int32Array& classes, + CFX_Int32Array& levels); +enum FX_BIDINEUTRALSTATE { + FX_BIDINEUTRALSTATE_r = 0, + FX_BIDINEUTRALSTATE_l, + FX_BIDINEUTRALSTATE_rn, + FX_BIDINEUTRALSTATE_ln, + FX_BIDINEUTRALSTATE_a, + FX_BIDINEUTRALSTATE_na, +}; +#define FX_BNSr FX_BIDINEUTRALSTATE_r +#define FX_BNSl FX_BIDINEUTRALSTATE_l +#define FX_BNSrn FX_BIDINEUTRALSTATE_rn +#define FX_BNSln FX_BIDINEUTRALSTATE_ln +#define FX_BNSa FX_BIDINEUTRALSTATE_a +#define FX_BNSna FX_BIDINEUTRALSTATE_na +enum FX_BIDINEUTRALACTION { + FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L, + FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4), + FX_BIDINEUTRALACTION_Rn = (FX_BIDICLASS_R << 4), + FX_BIDINEUTRALACTION_Ln = (FX_BIDICLASS_L << 4), + FX_BIDINEUTRALACTION_In = FX_BIDIWEAKACTION_IX, + FX_BIDINEUTRALACTION_LnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, +}; +#define FX_BNAnL FX_BIDINEUTRALACTION_nL +#define FX_BNAEn FX_BIDINEUTRALACTION_En +#define FX_BNARn FX_BIDINEUTRALACTION_Rn +#define FX_BNALn FX_BIDINEUTRALACTION_Ln +#define FX_BNAIn FX_BIDINEUTRALACTION_In +#define FX_BNALnL FX_BIDINEUTRALACTION_LnL +int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel); +int32_t FX_BidiGetResolvedNeutrals(int32_t iAction); +void FX_BidiResolveNeutrals(int32_t iBaseLevel, + CFX_Int32Array& classes, + const CFX_Int32Array& levels); +void FX_BidiResolveImplicit(const CFX_Int32Array& classes, + CFX_Int32Array& levels); +void FX_BidiResolveWhitespace(int32_t iBaseLevel, + const CFX_Int32Array& classes, + CFX_Int32Array& levels); +int32_t FX_BidiReorderLevel(int32_t iBaseLevel, + CFX_WideString& wsText, + const CFX_Int32Array& levels, + int32_t iStart, + FX_BOOL bReverse = FALSE); +void FX_BidiReorder(int32_t iBaseLevel, + CFX_WideString& wsText, + const CFX_Int32Array& levels); + +#endif // CORE_FXCRT_INCLUDE_FX_ARABIC_H_ diff --git a/core/fxcrt/include/fx_arb.h b/core/fxcrt/include/fx_arb.h index 6a0af83150..6928519a80 100644 --- a/core/fxcrt/include/fx_arb.h +++ b/core/fxcrt/include/fx_arb.h @@ -10,8 +10,6 @@ #include "core/fxcrt/include/fx_system.h" #include "core/fxcrt/include/fx_ucd.h" -class IFX_ArabicChar; - struct FX_ARBFORMTABLE { uint16_t wIsolated; uint16_t wFinal; @@ -40,21 +38,6 @@ enum FX_ARBPOSITION { FX_ARBPOSITION_Medial, }; -class IFX_ArabicChar { - public: - static IFX_ArabicChar* Create(); - virtual ~IFX_ArabicChar() {} - virtual void Release() = 0; - virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const = 0; - virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const = 0; - virtual FX_WCHAR GetFormChar(FX_WCHAR wch, - FX_WCHAR prev = 0, - FX_WCHAR next = 0) const = 0; - virtual FX_WCHAR GetFormChar(const CFX_Char* cur, - const CFX_Char* prev, - const CFX_Char* next) const = 0; -}; - void FX_BidiLine(CFX_WideString& wsText, int32_t iBaseLevel = 0); void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h index 37adc832f4..02ab44d6b8 100644 --- a/core/fxge/include/fx_font.h +++ b/core/fxge/include/fx_font.h @@ -532,15 +532,6 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); -class IFX_GSUBTable { - public: - static IFX_GSUBTable* Create(CFX_Font* pFont); - virtual FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) = 0; - - protected: - virtual ~IFX_GSUBTable() {} -}; - CFX_ByteString GetNameFromTT(const uint8_t* name_table, uint32_t name_table_size, uint32_t name); -- cgit v1.2.3