1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_INCLUDE_FXCRT_FX_ARB_H_ 8 #define CORE_INCLUDE_FXCRT_FX_ARB_H_ 9 10 #include "fx_system.h" 11 #include "fx_ucd.h" 12 13 class IFX_ArabicChar; 14 15 struct FX_ARBFORMTABLE { 16 FX_WCHAR wIsolated; 17 FX_WCHAR wFinal; 18 FX_WCHAR wInitial; 19 FX_WCHAR wMedial; 20 }; 21 22 struct FX_ARAALEF { 23 FX_WCHAR wAlef; 24 FX_WCHAR wIsolated; 25 }; 26 27 struct FX_ARASHADDA { 28 FX_WCHAR wShadda; 29 FX_WCHAR wIsolated; 30 }; 31 32 const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode); 33 FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef); 34 FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda); 35 36 enum FX_ARBPOSITION { 37 FX_ARBPOSITION_Isolated = 0, 38 FX_ARBPOSITION_Final, 39 FX_ARBPOSITION_Initial, 40 FX_ARBPOSITION_Medial, 41 }; 42 43 class IFX_ArabicChar { 44 public: 45 static IFX_ArabicChar* Create(); ~IFX_ArabicChar()46 virtual ~IFX_ArabicChar() {} 47 virtual void Release() = 0; 48 virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const = 0; 49 virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const = 0; 50 virtual FX_WCHAR GetFormChar(FX_WCHAR wch, 51 FX_WCHAR prev = 0, 52 FX_WCHAR next = 0) const = 0; 53 virtual FX_WCHAR GetFormChar(const CFX_Char* cur, 54 const CFX_Char* prev, 55 const CFX_Char* next) const = 0; 56 }; 57 58 void FX_BidiLine(CFX_WideString& wsText, int32_t iBaseLevel = 0); 59 void FX_BidiLine(CFX_TxtCharArray& chars, 60 int32_t iCount, 61 int32_t iBaseLevel = 0); 62 void FX_BidiLine(CFX_RTFCharArray& chars, 63 int32_t iCount, 64 int32_t iBaseLevel = 0); 65 66 #endif // CORE_INCLUDE_FXCRT_FX_ARB_H_ 67