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 _FX_UNICODE_ 8 #define _FX_UNICODE_ 9 enum FX_CHARBREAKPROP { 10 FX_CBP_OP = 0, 11 FX_CBP_CL = 1, 12 FX_CBP_QU = 2, 13 FX_CBP_GL = 3, 14 FX_CBP_NS = 4, 15 FX_CBP_EX = 5, 16 FX_CBP_SY = 6, 17 FX_CBP_IS = 7, 18 FX_CBP_PR = 8, 19 FX_CBP_PO = 9, 20 FX_CBP_NU = 10, 21 FX_CBP_AL = 11, 22 FX_CBP_ID = 12, 23 FX_CBP_IN = 13, 24 FX_CBP_HY = 14, 25 FX_CBP_BA = 15, 26 FX_CBP_BB = 16, 27 FX_CBP_B2 = 17, 28 FX_CBP_ZW = 18, 29 FX_CBP_CM = 19, 30 FX_CBP_WJ = 20, 31 FX_CBP_H2 = 21, 32 FX_CBP_H3 = 22, 33 FX_CBP_JL = 23, 34 FX_CBP_JV = 24, 35 FX_CBP_JT = 25, 36 37 FX_CBP_BK = 26, 38 FX_CBP_CR = 27, 39 FX_CBP_LF = 28, 40 FX_CBP_NL = 29, 41 FX_CBP_SA = 30, 42 FX_CBP_SG = 31, 43 FX_CBP_CB = 32, 44 FX_CBP_XX = 33, 45 FX_CBP_AI = 34, 46 FX_CBP_SP = 35, 47 FX_CBP_TB = 37, 48 FX_CBP_NONE = 36, 49 }; 50 #define FX_BIDICLASSBITS 6 51 #define FX_BIDICLASSBITSMASK (31 << FX_BIDICLASSBITS) 52 enum FX_BIDICLASS { 53 FX_BIDICLASS_ON = 0, 54 FX_BIDICLASS_L = 1, 55 FX_BIDICLASS_R = 2, 56 FX_BIDICLASS_AN = 3, 57 FX_BIDICLASS_EN = 4, 58 FX_BIDICLASS_AL = 5, 59 FX_BIDICLASS_NSM = 6, 60 FX_BIDICLASS_CS = 7, 61 FX_BIDICLASS_ES = 8, 62 FX_BIDICLASS_ET = 9, 63 FX_BIDICLASS_BN = 10, 64 FX_BIDICLASS_S = 11, 65 FX_BIDICLASS_WS = 12, 66 FX_BIDICLASS_B = 13, 67 FX_BIDICLASS_RLO = 14, 68 FX_BIDICLASS_RLE = 15, 69 FX_BIDICLASS_LRO = 16, 70 FX_BIDICLASS_LRE = 17, 71 FX_BIDICLASS_PDF = 18, 72 FX_BIDICLASS_N = FX_BIDICLASS_ON, 73 }; 74 #define FX_CHARTYPEBITS 11 75 #define FX_CHARTYPEBITSMASK (15 << FX_CHARTYPEBITS) 76 enum FX_CHARTYPE { 77 FX_CHARTYPE_Unknown = 0, 78 FX_CHARTYPE_Tab = (1 << FX_CHARTYPEBITS), 79 FX_CHARTYPE_Space = (2 << FX_CHARTYPEBITS), 80 FX_CHARTYPE_Control = (3 << FX_CHARTYPEBITS), 81 FX_CHARTYPE_Combination = (4 << FX_CHARTYPEBITS), 82 FX_CHARTYPE_Numeric = (5 << FX_CHARTYPEBITS), 83 FX_CHARTYPE_Normal = (6 << FX_CHARTYPEBITS), 84 FX_CHARTYPE_ArabicAlef = (7 << FX_CHARTYPEBITS), 85 FX_CHARTYPE_ArabicSpecial = (8 << FX_CHARTYPEBITS), 86 FX_CHARTYPE_ArabicDistortion = (9 << FX_CHARTYPEBITS), 87 FX_CHARTYPE_ArabicNormal = (10 << FX_CHARTYPEBITS), 88 FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), 89 FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), 90 }; 91 typedef struct _FX_CHARPROPERTIES { 92 union { 93 struct { 94 FX_DWORD dwBreakType : 6; 95 FX_DWORD dwBidiClass : 5; 96 FX_DWORD dwCharType : 4; 97 FX_DWORD dwRotation : 1; 98 FX_DWORD dwCJKSpecial : 1; 99 FX_DWORD dwVertIndex : 6; 100 FX_DWORD dwBidiIndex : 9; 101 }; 102 FX_DWORD dwCharProps; 103 }; 104 } FX_CHARPROPERTIES; 105 FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); 106 FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); 107 FX_BOOL FX_IsRotationCode(FX_WCHAR ch); 108 FX_BOOL FX_IsCombinationChar(FX_WCHAR wch); 109 FX_BOOL FX_IsBidiChar(FX_WCHAR wch); 110 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); 111 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, FX_BOOL bRTL, FX_BOOL bVertical); 112 #endif 113