OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/fxcrt/fx_ext.h" | 7 #include "../../include/fxcrt/fx_ext.h" |
8 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; | 8 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; |
9 extern const FX_WCHAR gs_FX_TextLayout_VerticalMirror[64]; | 9 extern const FX_WCHAR gs_FX_TextLayout_VerticalMirror[64]; |
10 extern const FX_WCHAR gs_FX_TextLayout_BidiMirror[512]; | 10 extern const FX_WCHAR gs_FX_TextLayout_BidiMirror[512]; |
(...skipping 11 matching lines...) Expand all Loading... |
22 return (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & 0x8000) != 0; | 22 return (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & 0x8000) != 0; |
23 } | 23 } |
24 FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) | 24 FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) |
25 { | 25 { |
26 FX_DWORD dwProps = (gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_CHART
YPEBITSMASK); | 26 FX_DWORD dwProps = (gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_CHART
YPEBITSMASK); |
27 return dwProps == FX_CHARTYPE_Combination; | 27 return dwProps == FX_CHARTYPE_Combination; |
28 } | 28 } |
29 FX_BOOL FX_IsBidiChar(FX_WCHAR wch) | 29 FX_BOOL FX_IsBidiChar(FX_WCHAR wch) |
30 { | 30 { |
31 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; | 31 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; |
32 FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; | 32 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; |
33 return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); | 33 return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); |
34 } | 34 } |
35 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) | 35 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) |
36 { | 36 { |
37 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; | 37 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; |
38 FX_DWORD dwTemp = (dwProps & 0xFF800000); | 38 FX_DWORD dwTemp = (dwProps & 0xFF800000); |
39 if (bRTL && dwTemp < 0xFF800000) { | 39 if (bRTL && dwTemp < 0xFF800000) { |
40 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23]; | 40 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23]; |
41 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; | 41 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; |
42 } | 42 } |
(...skipping 13 matching lines...) Expand all Loading... |
56 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; | 56 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; |
57 } | 57 } |
58 if (bVertical) { | 58 if (bVertical) { |
59 dwTemp = (dwProps & 0x007E0000); | 59 dwTemp = (dwProps & 0x007E0000); |
60 if (dwTemp < 0x007E0000) { | 60 if (dwTemp < 0x007E0000) { |
61 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17]; | 61 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17]; |
62 } | 62 } |
63 } | 63 } |
64 return wch; | 64 return wch; |
65 } | 65 } |
OLD | NEW |