Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: core/src/fxcrt/fx_unicode.cpp

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ucd.h" 7 #include "../../include/fxcrt/fx_ucd.h"
8 8
9 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; 9 extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536];
10 extern const FX_WCHAR gs_FX_TextLayout_VerticalMirror[64]; 10 extern const FX_WCHAR gs_FX_TextLayout_VerticalMirror[64];
11 extern const FX_WCHAR gs_FX_TextLayout_BidiMirror[512]; 11 extern const FX_WCHAR gs_FX_TextLayout_BidiMirror[512];
12 FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) 12 FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) {
13 { 13 return gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
14 return gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
15 } 14 }
16 FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) 15 FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) {
17 { 16 FX_DWORD dwRet =
18 FX_DWORD dwRet = (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & FX_CHARTYPE BITSMASK); 17 (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & FX_CHARTYPEBITSMASK);
19 return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; 18 return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
20 } 19 }
21 FX_BOOL FX_IsRotationCode(FX_WCHAR ch) 20 FX_BOOL FX_IsRotationCode(FX_WCHAR ch) {
22 { 21 return (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & 0x8000) != 0;
23 return (gs_FX_TextLayout_CodeProperties[(FX_WORD)ch] & 0x8000) != 0;
24 } 22 }
25 FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) 23 FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) {
26 { 24 FX_DWORD dwProps =
27 FX_DWORD dwProps = (gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_CHART YPEBITSMASK); 25 (gs_FX_TextLayout_CodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK);
28 return dwProps == FX_CHARTYPE_Combination; 26 return dwProps == FX_CHARTYPE_Combination;
29 } 27 }
30 FX_BOOL»FX_IsBidiChar(FX_WCHAR wch) 28 FX_BOOL FX_IsBidiChar(FX_WCHAR wch) {
31 { 29 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
32 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; 30 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
33 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; 31 return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls);
34 return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls);
35 } 32 }
36 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) 33 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
37 { 34 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
38 FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; 35 FX_DWORD dwTemp = (dwProps & 0xFF800000);
39 FX_DWORD dwTemp = (dwProps & 0xFF800000); 36 if (bRTL && dwTemp < 0xFF800000) {
40 if (bRTL && dwTemp < 0xFF800000) { 37 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23];
41 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23]; 38 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
42 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; 39 }
40 if (bVertical) {
41 dwTemp = (dwProps & 0x007E0000);
42 if (dwTemp < 0x007E0000) {
43 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17];
43 } 44 }
44 if (bVertical) { 45 }
45 dwTemp = (dwProps & 0x007E0000); 46 return wch;
46 if (dwTemp < 0x007E0000) { 47 }
47 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17]; 48 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
48 } 49 FX_DWORD dwProps,
50 FX_BOOL bRTL,
51 FX_BOOL bVertical) {
52 FX_DWORD dwTemp = (dwProps & 0xFF800000);
53 if (bRTL && dwTemp < 0xFF800000) {
54 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23];
55 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
56 }
57 if (bVertical) {
58 dwTemp = (dwProps & 0x007E0000);
59 if (dwTemp < 0x007E0000) {
60 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17];
49 } 61 }
50 return wch; 62 }
63 return wch;
51 } 64 }
52 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_DWORD dwProps, FX_BOOL bRTL, FX_BOOL bVertical)
53 {
54 FX_DWORD dwTemp = (dwProps & 0xFF800000);
55 if (bRTL && dwTemp < 0xFF800000) {
56 wch = gs_FX_TextLayout_BidiMirror[dwTemp >> 23];
57 dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch];
58 }
59 if (bVertical) {
60 dwTemp = (dwProps & 0x007E0000);
61 if (dwTemp < 0x007E0000) {
62 wch = gs_FX_TextLayout_VerticalMirror[dwTemp >> 17];
63 }
64 }
65 return wch;
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698