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_FXCRT_FX_UNICODE_H_ 8 #define CORE_FXCRT_FX_UNICODE_H_ 9 10 #include "core/fxcrt/retain_ptr.h" 11 12 uint32_t FX_GetUnicodeProperties(wchar_t wch); 13 wchar_t FX_GetMirrorChar(wchar_t wch); 14 15 #ifdef PDF_ENABLE_XFA 16 17 // As defined in http://www.unicode.org/reports/tr14 18 constexpr uint8_t kBreakPropertySpace = 35; 19 constexpr uint8_t kBreakPropertyTB = 37; // Don't know what this is ... 20 21 constexpr uint32_t FX_CHARTYPEBITS = 11; 22 constexpr uint32_t FX_CHARTYPEBITSMASK = 0xF << FX_CHARTYPEBITS; 23 24 enum FX_CHARTYPE { 25 FX_CHARTYPE_Unknown = 0, 26 FX_CHARTYPE_Tab = (1 << FX_CHARTYPEBITS), 27 FX_CHARTYPE_Space = (2 << FX_CHARTYPEBITS), 28 FX_CHARTYPE_Control = (3 << FX_CHARTYPEBITS), 29 FX_CHARTYPE_Combination = (4 << FX_CHARTYPEBITS), 30 FX_CHARTYPE_Numeric = (5 << FX_CHARTYPEBITS), 31 FX_CHARTYPE_Normal = (6 << FX_CHARTYPEBITS), 32 FX_CHARTYPE_ArabicAlef = (7 << FX_CHARTYPEBITS), 33 FX_CHARTYPE_ArabicSpecial = (8 << FX_CHARTYPEBITS), 34 FX_CHARTYPE_ArabicDistortion = (9 << FX_CHARTYPEBITS), 35 FX_CHARTYPE_ArabicNormal = (10 << FX_CHARTYPEBITS), 36 FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), 37 FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), 38 }; 39 40 inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { 41 return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK); 42 } 43 44 wchar_t FX_GetMirrorChar(wchar_t wch, uint32_t dwProps); 45 46 #endif // PDF_ENABLE_XFA 47 48 #endif // CORE_FXCRT_FX_UNICODE_H_ 49