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

Side by Side Diff: xfa/fgas/layout/fgas_textbreak.cpp

Issue 1830323006: Remove FX_DWORD from XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "xfa/fgas/layout/fgas_textbreak.h" 7 #include "xfa/fgas/layout/fgas_textbreak.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 CFX_TxtCharArray* m_pLineChars; 56 CFX_TxtCharArray* m_pLineChars;
57 CFX_TxtPieceArray* m_pLinePieces; 57 CFX_TxtPieceArray* m_pLinePieces;
58 int32_t m_iStart; 58 int32_t m_iStart;
59 int32_t m_iWidth; 59 int32_t m_iWidth;
60 int32_t m_iArabicChars; 60 int32_t m_iArabicChars;
61 }; 61 };
62 62
63 class CFX_TxtBreak : public IFX_TxtBreak { 63 class CFX_TxtBreak : public IFX_TxtBreak {
64 public: 64 public:
65 CFX_TxtBreak(FX_DWORD dwPolicies); 65 CFX_TxtBreak(uint32_t dwPolicies);
66 ~CFX_TxtBreak(); 66 ~CFX_TxtBreak();
67 virtual void Release() { delete this; } 67 virtual void Release() { delete this; }
68 virtual void SetLineWidth(FX_FLOAT fLineWidth); 68 virtual void SetLineWidth(FX_FLOAT fLineWidth);
69 virtual void SetLinePos(FX_FLOAT fLinePos); 69 virtual void SetLinePos(FX_FLOAT fLinePos);
70 virtual FX_DWORD GetLayoutStyles() const { return m_dwLayoutStyles; } 70 virtual uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
71 virtual void SetLayoutStyles(FX_DWORD dwLayoutStyles); 71 virtual void SetLayoutStyles(uint32_t dwLayoutStyles);
72 virtual void SetFont(IFX_Font* pFont); 72 virtual void SetFont(IFX_Font* pFont);
73 virtual void SetFontSize(FX_FLOAT fFontSize); 73 virtual void SetFontSize(FX_FLOAT fFontSize);
74 virtual void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); 74 virtual void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
75 virtual void SetDefaultChar(FX_WCHAR wch); 75 virtual void SetDefaultChar(FX_WCHAR wch);
76 virtual void SetParagraphBreakChar(FX_WCHAR wch); 76 virtual void SetParagraphBreakChar(FX_WCHAR wch);
77 virtual void SetLineBreakTolerance(FX_FLOAT fTolerance); 77 virtual void SetLineBreakTolerance(FX_FLOAT fTolerance);
78 virtual void SetHorizontalScale(int32_t iScale); 78 virtual void SetHorizontalScale(int32_t iScale);
79 virtual void SetVerticalScale(int32_t iScale); 79 virtual void SetVerticalScale(int32_t iScale);
80 virtual void SetCharRotation(int32_t iCharRotation); 80 virtual void SetCharRotation(int32_t iCharRotation);
81 virtual void SetCharSpace(FX_FLOAT fCharSpace); 81 virtual void SetCharSpace(FX_FLOAT fCharSpace);
82 virtual void SetAlignment(int32_t iAlignment); 82 virtual void SetAlignment(int32_t iAlignment);
83 virtual FX_DWORD GetContextCharStyles() const; 83 virtual uint32_t GetContextCharStyles() const;
84 virtual void SetContextCharStyles(FX_DWORD dwCharStyles); 84 virtual void SetContextCharStyles(uint32_t dwCharStyles);
85 virtual void SetCombWidth(FX_FLOAT fCombWidth); 85 virtual void SetCombWidth(FX_FLOAT fCombWidth);
86 virtual void SetUserData(void* pUserData); 86 virtual void SetUserData(void* pUserData);
87 virtual FX_DWORD AppendChar(FX_WCHAR wch); 87 virtual uint32_t AppendChar(FX_WCHAR wch);
88 virtual FX_DWORD EndBreak(FX_DWORD dwStatus = FX_TXTBREAK_PieceBreak); 88 virtual uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
89 virtual int32_t CountBreakChars() const; 89 virtual int32_t CountBreakChars() const;
90 virtual int32_t CountBreakPieces() const; 90 virtual int32_t CountBreakPieces() const;
91 virtual const CFX_TxtPiece* GetBreakPiece(int32_t index) const; 91 virtual const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
92 virtual void ClearBreakPieces(); 92 virtual void ClearBreakPieces();
93 virtual void Reset(); 93 virtual void Reset();
94 virtual int32_t GetDisplayPos( 94 virtual int32_t GetDisplayPos(
95 const FX_TXTRUN* pTxtRun, 95 const FX_TXTRUN* pTxtRun,
96 FXTEXT_CHARPOS* pCharPos, 96 FXTEXT_CHARPOS* pCharPos,
97 FX_BOOL bCharCode = FALSE, 97 FX_BOOL bCharCode = FALSE,
98 CFX_WideString* pWSForms = NULL, 98 CFX_WideString* pWSForms = NULL,
99 FX_AdjustCharDisplayPos pAdjustPos = NULL) const; 99 FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
100 virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun, 100 virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
101 CFX_RectFArray& rtArray, 101 CFX_RectFArray& rtArray,
102 FX_BOOL bCharBBox = FALSE) const; 102 FX_BOOL bCharBBox = FALSE) const;
103 void AppendChar_PageLoad(CFX_Char* pCurChar, FX_DWORD dwProps); 103 void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps);
104 FX_DWORD AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation); 104 uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation);
105 FX_DWORD AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation); 105 uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation);
106 FX_DWORD AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation); 106 uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation);
107 FX_DWORD AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation); 107 uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation);
108 FX_DWORD AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation); 108 uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation);
109 109
110 protected: 110 protected:
111 FX_DWORD m_dwPolicies; 111 uint32_t m_dwPolicies;
112 FX_BOOL m_bPagination; 112 FX_BOOL m_bPagination;
113 IFX_ArabicChar* m_pArabicChar; 113 IFX_ArabicChar* m_pArabicChar;
114 int32_t m_iLineWidth; 114 int32_t m_iLineWidth;
115 FX_DWORD m_dwLayoutStyles; 115 uint32_t m_dwLayoutStyles;
116 FX_BOOL m_bVertical; 116 FX_BOOL m_bVertical;
117 FX_BOOL m_bArabicContext; 117 FX_BOOL m_bArabicContext;
118 FX_BOOL m_bArabicShapes; 118 FX_BOOL m_bArabicShapes;
119 FX_BOOL m_bRTL; 119 FX_BOOL m_bRTL;
120 FX_BOOL m_bSingleLine; 120 FX_BOOL m_bSingleLine;
121 FX_BOOL m_bCombText; 121 FX_BOOL m_bCombText;
122 int32_t m_iArabicContext; 122 int32_t m_iArabicContext;
123 int32_t m_iCurArabicContext; 123 int32_t m_iCurArabicContext;
124 IFX_Font* m_pFont; 124 IFX_Font* m_pFont;
125 int32_t m_iFontSize; 125 int32_t m_iFontSize;
126 FX_BOOL m_bEquidistant; 126 FX_BOOL m_bEquidistant;
127 int32_t m_iTabWidth; 127 int32_t m_iTabWidth;
128 FX_WCHAR m_wDefChar; 128 FX_WCHAR m_wDefChar;
129 FX_WCHAR m_wParagBreakChar; 129 FX_WCHAR m_wParagBreakChar;
130 int32_t m_iDefChar; 130 int32_t m_iDefChar;
131 int32_t m_iLineRotation; 131 int32_t m_iLineRotation;
132 int32_t m_iCharRotation; 132 int32_t m_iCharRotation;
133 int32_t m_iRotation; 133 int32_t m_iRotation;
134 int32_t m_iAlignment; 134 int32_t m_iAlignment;
135 FX_DWORD m_dwContextCharStyles; 135 uint32_t m_dwContextCharStyles;
136 int32_t m_iCombWidth; 136 int32_t m_iCombWidth;
137 void* m_pUserData; 137 void* m_pUserData;
138 FX_DWORD m_dwCharType; 138 uint32_t m_dwCharType;
139 FX_BOOL m_bCurRTL; 139 FX_BOOL m_bCurRTL;
140 int32_t m_iCurAlignment; 140 int32_t m_iCurAlignment;
141 FX_BOOL m_bArabicNumber; 141 FX_BOOL m_bArabicNumber;
142 FX_BOOL m_bArabicComma; 142 FX_BOOL m_bArabicComma;
143 CFX_TxtLine* m_pTxtLine1; 143 CFX_TxtLine* m_pTxtLine1;
144 CFX_TxtLine* m_pTxtLine2; 144 CFX_TxtLine* m_pTxtLine2;
145 CFX_TxtLine* m_pCurLine; 145 CFX_TxtLine* m_pCurLine;
146 int32_t m_iReady; 146 int32_t m_iReady;
147 int32_t m_iTolerance; 147 int32_t m_iTolerance;
148 int32_t m_iHorScale; 148 int32_t m_iHorScale;
149 int32_t m_iVerScale; 149 int32_t m_iVerScale;
150 int32_t m_iCharSpace; 150 int32_t m_iCharSpace;
151 void SetBreakStatus(); 151 void SetBreakStatus();
152 int32_t GetLineRotation(FX_DWORD dwStyles) const; 152 int32_t GetLineRotation(uint32_t dwStyles) const;
153 CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const; 153 CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const;
154 CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const; 154 CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const;
155 CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const; 155 CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const;
156 FX_DWORD GetUnifiedCharType(FX_DWORD dwType) const; 156 uint32_t GetUnifiedCharType(uint32_t dwType) const;
157 void ResetArabicContext(); 157 void ResetArabicContext();
158 void ResetContextCharStyles(); 158 void ResetContextCharStyles();
159 void EndBreak_UpdateArabicShapes(); 159 void EndBreak_UpdateArabicShapes();
160 FX_BOOL EndBreak_SplitLine(CFX_TxtLine* pNextLine, 160 FX_BOOL EndBreak_SplitLine(CFX_TxtLine* pNextLine,
161 FX_BOOL bAllChars, 161 FX_BOOL bAllChars,
162 FX_DWORD dwStatus); 162 uint32_t dwStatus);
163 void EndBreak_BidiLine(CFX_TPOArray& tpos, FX_DWORD dwStatus); 163 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
164 void EndBreak_Alignment(CFX_TPOArray& tpos, 164 void EndBreak_Alignment(CFX_TPOArray& tpos,
165 FX_BOOL bAllChars, 165 FX_BOOL bAllChars,
166 FX_DWORD dwStatus); 166 uint32_t dwStatus);
167 int32_t GetBreakPos(CFX_TxtCharArray& ca, 167 int32_t GetBreakPos(CFX_TxtCharArray& ca,
168 int32_t& iEndPos, 168 int32_t& iEndPos,
169 FX_BOOL bAllChars = FALSE, 169 FX_BOOL bAllChars = FALSE,
170 FX_BOOL bOnlyBrk = FALSE); 170 FX_BOOL bOnlyBrk = FALSE);
171 void SplitTextLine(CFX_TxtLine* pCurLine, 171 void SplitTextLine(CFX_TxtLine* pCurLine,
172 CFX_TxtLine* pNextLine, 172 CFX_TxtLine* pNextLine,
173 FX_BOOL bAllChars = FALSE); 173 FX_BOOL bAllChars = FALSE);
174 }; 174 };
175 175
176 } // namespace 176 } // namespace
177 177
178 extern const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32]; 178 extern const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32];
179 IFX_TxtBreak* IFX_TxtBreak::Create(FX_DWORD dwPolicies) { 179 IFX_TxtBreak* IFX_TxtBreak::Create(uint32_t dwPolicies) {
180 return new CFX_TxtBreak(dwPolicies); 180 return new CFX_TxtBreak(dwPolicies);
181 } 181 }
182 CFX_TxtBreak::CFX_TxtBreak(FX_DWORD dwPolicies) 182 CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
183 : m_dwPolicies(dwPolicies), 183 : m_dwPolicies(dwPolicies),
184 m_pArabicChar(NULL), 184 m_pArabicChar(NULL),
185 m_iLineWidth(2000000), 185 m_iLineWidth(2000000),
186 m_dwLayoutStyles(0), 186 m_dwLayoutStyles(0),
187 m_bVertical(FALSE), 187 m_bVertical(FALSE),
188 m_bArabicContext(FALSE), 188 m_bArabicContext(FALSE),
189 m_bArabicShapes(FALSE), 189 m_bArabicShapes(FALSE),
190 m_bRTL(FALSE), 190 m_bRTL(FALSE),
191 m_bSingleLine(FALSE), 191 m_bSingleLine(FALSE),
192 m_bCombText(FALSE), 192 m_bCombText(FALSE),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f); 241 int32_t iLinePos = FXSYS_round(fLinePos * 20000.0f);
242 if (iLinePos < 0) { 242 if (iLinePos < 0) {
243 iLinePos = 0; 243 iLinePos = 0;
244 } 244 }
245 if (iLinePos > m_iLineWidth) { 245 if (iLinePos > m_iLineWidth) {
246 iLinePos = m_iLineWidth; 246 iLinePos = m_iLineWidth;
247 } 247 }
248 m_pCurLine->m_iStart = iLinePos; 248 m_pCurLine->m_iStart = iLinePos;
249 m_pCurLine->m_iWidth += iLinePos; 249 m_pCurLine->m_iWidth += iLinePos;
250 } 250 }
251 void CFX_TxtBreak::SetLayoutStyles(FX_DWORD dwLayoutStyles) { 251 void CFX_TxtBreak::SetLayoutStyles(uint32_t dwLayoutStyles) {
252 m_dwLayoutStyles = dwLayoutStyles; 252 m_dwLayoutStyles = dwLayoutStyles;
253 m_bVertical = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0; 253 m_bVertical = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0;
254 m_bArabicContext = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicContext) != 0; 254 m_bArabicContext = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicContext) != 0;
255 m_bArabicShapes = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicShapes) != 0; 255 m_bArabicShapes = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ArabicShapes) != 0;
256 m_bRTL = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_RTLReadingOrder) != 0; 256 m_bRTL = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_RTLReadingOrder) != 0;
257 m_bSingleLine = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; 257 m_bSingleLine = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0;
258 m_bCombText = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_CombText) != 0; 258 m_bCombText = (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_CombText) != 0;
259 ResetArabicContext(); 259 ResetArabicContext();
260 m_iLineRotation = GetLineRotation(m_dwLayoutStyles); 260 m_iLineRotation = GetLineRotation(m_dwLayoutStyles);
261 m_iRotation = m_iLineRotation + m_iCharRotation; 261 m_iRotation = m_iLineRotation + m_iCharRotation;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicNumber; 343 m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicNumber;
344 } 344 }
345 if (m_bArabicComma) { 345 if (m_bArabicComma) {
346 m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicComma; 346 m_dwContextCharStyles |= FX_TXTCHARSTYLE_ArabicComma;
347 } 347 }
348 if ((m_bArabicContext && m_bCurRTL) || (!m_bArabicContext && m_bRTL)) { 348 if ((m_bArabicContext && m_bCurRTL) || (!m_bArabicContext && m_bRTL)) {
349 m_dwContextCharStyles |= FX_TXTCHARSTYLE_RTLReadingOrder; 349 m_dwContextCharStyles |= FX_TXTCHARSTYLE_RTLReadingOrder;
350 } 350 }
351 m_dwContextCharStyles |= (m_iArabicContext << 8); 351 m_dwContextCharStyles |= (m_iArabicContext << 8);
352 } 352 }
353 FX_DWORD CFX_TxtBreak::GetContextCharStyles() const { 353 uint32_t CFX_TxtBreak::GetContextCharStyles() const {
354 return m_dwContextCharStyles; 354 return m_dwContextCharStyles;
355 } 355 }
356 void CFX_TxtBreak::SetContextCharStyles(FX_DWORD dwCharStyles) { 356 void CFX_TxtBreak::SetContextCharStyles(uint32_t dwCharStyles) {
357 m_iCurAlignment = dwCharStyles & 0x0F; 357 m_iCurAlignment = dwCharStyles & 0x0F;
358 m_bArabicNumber = (dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0; 358 m_bArabicNumber = (dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
359 m_bArabicComma = (dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0; 359 m_bArabicComma = (dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0;
360 m_bCurRTL = (dwCharStyles & FX_TXTCHARSTYLE_RTLReadingOrder) != 0; 360 m_bCurRTL = (dwCharStyles & FX_TXTCHARSTYLE_RTLReadingOrder) != 0;
361 m_iCurArabicContext = m_iArabicContext = ((dwCharStyles & 0x0300) >> 8); 361 m_iCurArabicContext = m_iArabicContext = ((dwCharStyles & 0x0300) >> 8);
362 ResetContextCharStyles(); 362 ResetContextCharStyles();
363 } 363 }
364 void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) { 364 void CFX_TxtBreak::SetCombWidth(FX_FLOAT fCombWidth) {
365 m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f); 365 m_iCombWidth = FXSYS_round(fCombWidth * 20000.0f);
366 } 366 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (iScale == m_iHorScale) { 401 if (iScale == m_iHorScale) {
402 return; 402 return;
403 } 403 }
404 SetBreakStatus(); 404 SetBreakStatus();
405 m_iVerScale = iScale; 405 m_iVerScale = iScale;
406 } 406 }
407 void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) { 407 void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) {
408 m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); 408 m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
409 } 409 }
410 static const int32_t gs_FX_TxtLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2}; 410 static const int32_t gs_FX_TxtLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2};
411 int32_t CFX_TxtBreak::GetLineRotation(FX_DWORD dwStyles) const { 411 int32_t CFX_TxtBreak::GetLineRotation(uint32_t dwStyles) const {
412 return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1]; 412 return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1];
413 } 413 }
414 CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { 414 CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const {
415 CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars; 415 CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars;
416 int32_t iCount = ca.GetSize(); 416 int32_t iCount = ca.GetSize();
417 if (index < 0 || index >= iCount) { 417 if (index < 0 || index >= iCount) {
418 return NULL; 418 return NULL;
419 } 419 }
420 CFX_TxtChar* pTC; 420 CFX_TxtChar* pTC;
421 int32_t iStart = iCount - 1; 421 int32_t iStart = iCount - 1;
(...skipping 20 matching lines...) Expand all
442 return NULL; 442 return NULL;
443 } 443 }
444 } 444 }
445 CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const { 445 CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const {
446 CFX_TxtLine* pTxtLine = GetTxtLine(bReady); 446 CFX_TxtLine* pTxtLine = GetTxtLine(bReady);
447 if (pTxtLine == NULL) { 447 if (pTxtLine == NULL) {
448 return NULL; 448 return NULL;
449 } 449 }
450 return pTxtLine->m_pLinePieces; 450 return pTxtLine->m_pLinePieces;
451 } 451 }
452 inline FX_DWORD CFX_TxtBreak::GetUnifiedCharType(FX_DWORD dwType) const { 452 inline uint32_t CFX_TxtBreak::GetUnifiedCharType(uint32_t dwType) const {
453 return dwType >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : dwType; 453 return dwType >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : dwType;
454 } 454 }
455 void CFX_TxtBreak::ResetArabicContext() { 455 void CFX_TxtBreak::ResetArabicContext() {
456 if (m_bArabicContext) { 456 if (m_bArabicContext) {
457 m_bCurRTL = m_iCurArabicContext > 1; 457 m_bCurRTL = m_iCurArabicContext > 1;
458 m_iCurAlignment = m_iCurArabicContext > 1 ? FX_TXTLINEALIGNMENT_Right 458 m_iCurAlignment = m_iCurArabicContext > 1 ? FX_TXTLINEALIGNMENT_Right
459 : FX_TXTLINEALIGNMENT_Left; 459 : FX_TXTLINEALIGNMENT_Left;
460 m_iCurAlignment |= (m_iAlignment & FX_TXTLINEALIGNMENT_HigherMask); 460 m_iCurAlignment |= (m_iAlignment & FX_TXTLINEALIGNMENT_HigherMask);
461 m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes; 461 m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes;
462 } else { 462 } else {
463 if (m_bPagination) { 463 if (m_bPagination) {
464 m_bCurRTL = FALSE; 464 m_bCurRTL = FALSE;
465 m_iCurAlignment = 0; 465 m_iCurAlignment = 0;
466 } else { 466 } else {
467 m_bCurRTL = m_bRTL; 467 m_bCurRTL = m_bRTL;
468 m_iCurAlignment = m_iAlignment; 468 m_iCurAlignment = m_iAlignment;
469 } 469 }
470 if (m_bRTL) { 470 if (m_bRTL) {
471 m_bArabicNumber = m_iArabicContext >= 1; 471 m_bArabicNumber = m_iArabicContext >= 1;
472 } else { 472 } else {
473 m_bArabicNumber = m_iArabicContext > 1; 473 m_bArabicNumber = m_iArabicContext > 1;
474 } 474 }
475 m_bArabicNumber = m_bArabicNumber && m_bArabicShapes; 475 m_bArabicNumber = m_bArabicNumber && m_bArabicShapes;
476 } 476 }
477 m_bArabicComma = m_bArabicNumber; 477 m_bArabicComma = m_bArabicNumber;
478 ResetContextCharStyles(); 478 ResetContextCharStyles();
479 } 479 }
480 void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar, FX_DWORD dwProps) { 480 void CFX_TxtBreak::AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps) {
481 if (!m_bPagination) { 481 if (!m_bPagination) {
482 ((CFX_TxtChar*)pCurChar)->m_dwStatus = 0; 482 ((CFX_TxtChar*)pCurChar)->m_dwStatus = 0;
483 ((CFX_TxtChar*)pCurChar)->m_pUserData = m_pUserData; 483 ((CFX_TxtChar*)pCurChar)->m_pUserData = m_pUserData;
484 } 484 }
485 if (m_bArabicContext || m_bArabicShapes) { 485 if (m_bArabicContext || m_bArabicShapes) {
486 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; 486 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS;
487 int32_t iArabicContext = 487 int32_t iArabicContext =
488 (iBidiCls == FX_BIDICLASS_R || iBidiCls == FX_BIDICLASS_AL) 488 (iBidiCls == FX_BIDICLASS_R || iBidiCls == FX_BIDICLASS_AL)
489 ? 2 489 ? 2
490 : ((iBidiCls == FX_BIDICLASS_L || iBidiCls == FX_BIDICLASS_S) ? 0 490 : ((iBidiCls == FX_BIDICLASS_L || iBidiCls == FX_BIDICLASS_S) ? 0
491 : 1); 491 : 1);
492 if (iArabicContext != m_iArabicContext && iArabicContext != 1) { 492 if (iArabicContext != m_iArabicContext && iArabicContext != 1) {
493 m_iArabicContext = iArabicContext; 493 m_iArabicContext = iArabicContext;
494 if (m_iCurArabicContext == 1) { 494 if (m_iCurArabicContext == 1) {
495 m_iCurArabicContext = iArabicContext; 495 m_iCurArabicContext = iArabicContext;
496 } 496 }
497 ResetArabicContext(); 497 ResetArabicContext();
498 if (!m_bPagination) { 498 if (!m_bPagination) {
499 CFX_TxtChar* pLastChar = (CFX_TxtChar*)GetLastChar(1, FALSE); 499 CFX_TxtChar* pLastChar = (CFX_TxtChar*)GetLastChar(1, FALSE);
500 if (pLastChar != NULL && pLastChar->m_dwStatus < 1) { 500 if (pLastChar != NULL && pLastChar->m_dwStatus < 1) {
501 pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak; 501 pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak;
502 } 502 }
503 } 503 }
504 } 504 }
505 } 505 }
506 pCurChar->m_dwCharStyles = m_dwContextCharStyles; 506 pCurChar->m_dwCharStyles = m_dwContextCharStyles;
507 } 507 }
508 FX_DWORD CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar, 508 uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar,
509 int32_t iRotation) { 509 int32_t iRotation) {
510 FXSYS_assert(pCurChar != NULL); 510 FXSYS_assert(pCurChar != NULL);
511 FX_WCHAR wch = pCurChar->m_wCharCode; 511 FX_WCHAR wch = pCurChar->m_wCharCode;
512 FX_WCHAR wForm; 512 FX_WCHAR wForm;
513 int32_t iCharWidth = 0; 513 int32_t iCharWidth = 0;
514 CFX_Char* pLastChar; 514 CFX_Char* pLastChar;
515 pCurChar->m_iCharWidth = -1; 515 pCurChar->m_iCharWidth = -1;
516 if (m_bCombText) { 516 if (m_bCombText) {
517 iCharWidth = m_iCombWidth; 517 iCharWidth = m_iCombWidth;
518 } else { 518 } else {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { 550 if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) {
551 iCharWidth = 0; 551 iCharWidth = 0;
552 } 552 }
553 } 553 }
554 iCharWidth *= m_iFontSize; 554 iCharWidth *= m_iFontSize;
555 iCharWidth = iCharWidth * m_iHorScale / 100; 555 iCharWidth = iCharWidth * m_iHorScale / 100;
556 } 556 }
557 pCurChar->m_iCharWidth = -iCharWidth; 557 pCurChar->m_iCharWidth = -iCharWidth;
558 return FX_TXTBREAK_None; 558 return FX_TXTBREAK_None;
559 } 559 }
560 FX_DWORD CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation) { 560 uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation) {
561 m_dwCharType = FX_CHARTYPE_Tab; 561 m_dwCharType = FX_CHARTYPE_Tab;
562 if ((m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ExpandTab) == 0) { 562 if ((m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ExpandTab) == 0) {
563 return FX_TXTBREAK_None; 563 return FX_TXTBREAK_None;
564 } 564 }
565 int32_t& iLineWidth = m_pCurLine->m_iWidth; 565 int32_t& iLineWidth = m_pCurLine->m_iWidth;
566 int32_t iCharWidth; 566 int32_t iCharWidth;
567 if (m_bCombText) { 567 if (m_bCombText) {
568 iCharWidth = m_iCombWidth; 568 iCharWidth = m_iCombWidth;
569 } else { 569 } else {
570 if (m_bEquidistant) { 570 if (m_bEquidistant) {
571 iCharWidth = iLineWidth; 571 iCharWidth = iLineWidth;
572 iCharWidth = m_iTabWidth * (iCharWidth / m_iTabWidth + 1) - iCharWidth; 572 iCharWidth = m_iTabWidth * (iCharWidth / m_iTabWidth + 1) - iCharWidth;
573 if (iCharWidth < FX_TXTBREAK_MinimumTabWidth) { 573 if (iCharWidth < FX_TXTBREAK_MinimumTabWidth) {
574 iCharWidth += m_iTabWidth; 574 iCharWidth += m_iTabWidth;
575 } 575 }
576 } else { 576 } else {
577 iCharWidth = m_iTabWidth; 577 iCharWidth = m_iTabWidth;
578 } 578 }
579 } 579 }
580 pCurChar->m_iCharWidth = iCharWidth; 580 pCurChar->m_iCharWidth = iCharWidth;
581 iLineWidth += iCharWidth; 581 iLineWidth += iCharWidth;
582 if (!m_bSingleLine && iLineWidth >= m_iLineWidth + m_iTolerance) { 582 if (!m_bSingleLine && iLineWidth >= m_iLineWidth + m_iTolerance) {
583 return EndBreak(FX_TXTBREAK_LineBreak); 583 return EndBreak(FX_TXTBREAK_LineBreak);
584 } 584 }
585 return FX_TXTBREAK_None; 585 return FX_TXTBREAK_None;
586 } 586 }
587 FX_DWORD CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar, 587 uint32_t CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar,
588 int32_t iRotation) { 588 int32_t iRotation) {
589 m_dwCharType = FX_CHARTYPE_Control; 589 m_dwCharType = FX_CHARTYPE_Control;
590 FX_DWORD dwRet = FX_TXTBREAK_None; 590 uint32_t dwRet = FX_TXTBREAK_None;
591 if (!m_bSingleLine) { 591 if (!m_bSingleLine) {
592 FX_WCHAR wch = pCurChar->m_wCharCode; 592 FX_WCHAR wch = pCurChar->m_wCharCode;
593 switch (wch) { 593 switch (wch) {
594 case L'\v': 594 case L'\v':
595 case 0x2028: 595 case 0x2028:
596 dwRet = FX_TXTBREAK_LineBreak; 596 dwRet = FX_TXTBREAK_LineBreak;
597 break; 597 break;
598 case L'\f': 598 case L'\f':
599 dwRet = FX_TXTBREAK_PageBreak; 599 dwRet = FX_TXTBREAK_PageBreak;
600 break; 600 break;
601 case 0x2029: 601 case 0x2029:
602 dwRet = FX_TXTBREAK_ParagraphBreak; 602 dwRet = FX_TXTBREAK_ParagraphBreak;
603 break; 603 break;
604 default: 604 default:
605 if (wch == m_wParagBreakChar) { 605 if (wch == m_wParagBreakChar) {
606 dwRet = FX_TXTBREAK_ParagraphBreak; 606 dwRet = FX_TXTBREAK_ParagraphBreak;
607 } 607 }
608 break; 608 break;
609 } 609 }
610 if (dwRet != FX_TXTBREAK_None) { 610 if (dwRet != FX_TXTBREAK_None) {
611 dwRet = EndBreak(dwRet); 611 dwRet = EndBreak(dwRet);
612 } 612 }
613 } 613 }
614 return dwRet; 614 return dwRet;
615 } 615 }
616 FX_DWORD CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar, 616 uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar,
617 int32_t iRotation) { 617 int32_t iRotation) {
618 FX_DWORD dwType = (pCurChar->m_dwCharProps & FX_CHARTYPEBITSMASK); 618 uint32_t dwType = (pCurChar->m_dwCharProps & FX_CHARTYPEBITSMASK);
619 int32_t& iLineWidth = m_pCurLine->m_iWidth; 619 int32_t& iLineWidth = m_pCurLine->m_iWidth;
620 FX_WCHAR wForm; 620 FX_WCHAR wForm;
621 int32_t iCharWidth = 0; 621 int32_t iCharWidth = 0;
622 CFX_Char* pLastChar = NULL; 622 CFX_Char* pLastChar = NULL;
623 FX_BOOL bAlef = FALSE; 623 FX_BOOL bAlef = FALSE;
624 if (!m_bCombText && m_dwCharType >= FX_CHARTYPE_ArabicAlef && 624 if (!m_bCombText && m_dwCharType >= FX_CHARTYPE_ArabicAlef &&
625 m_dwCharType <= FX_CHARTYPE_ArabicDistortion) { 625 m_dwCharType <= FX_CHARTYPE_ArabicDistortion) {
626 pLastChar = GetLastChar(1); 626 pLastChar = GetLastChar(1);
627 if (pLastChar != NULL) { 627 if (pLastChar != NULL) {
628 iCharWidth = pLastChar->m_iCharWidth; 628 iCharWidth = pLastChar->m_iCharWidth;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 iCharWidth = iCharWidth * m_iHorScale / 100; 669 iCharWidth = iCharWidth * m_iHorScale / 100;
670 } 670 }
671 pCurChar->m_iCharWidth = iCharWidth; 671 pCurChar->m_iCharWidth = iCharWidth;
672 iLineWidth += iCharWidth; 672 iLineWidth += iCharWidth;
673 m_pCurLine->m_iArabicChars++; 673 m_pCurLine->m_iArabicChars++;
674 if (!m_bSingleLine && iLineWidth > m_iLineWidth + m_iTolerance) { 674 if (!m_bSingleLine && iLineWidth > m_iLineWidth + m_iTolerance) {
675 return EndBreak(FX_TXTBREAK_LineBreak); 675 return EndBreak(FX_TXTBREAK_LineBreak);
676 } 676 }
677 return FX_TXTBREAK_None; 677 return FX_TXTBREAK_None;
678 } 678 }
679 FX_DWORD CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar, 679 uint32_t CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar,
680 int32_t iRotation) { 680 int32_t iRotation) {
681 FX_DWORD dwProps = pCurChar->m_dwCharProps; 681 uint32_t dwProps = pCurChar->m_dwCharProps;
682 FX_DWORD dwType = (dwProps & FX_CHARTYPEBITSMASK); 682 uint32_t dwType = (dwProps & FX_CHARTYPEBITSMASK);
683 int32_t& iLineWidth = m_pCurLine->m_iWidth; 683 int32_t& iLineWidth = m_pCurLine->m_iWidth;
684 int32_t iCharWidth = 0; 684 int32_t iCharWidth = 0;
685 m_dwCharType = dwType; 685 m_dwCharType = dwType;
686 FX_WCHAR wch = pCurChar->m_wCharCode; 686 FX_WCHAR wch = pCurChar->m_wCharCode;
687 FX_WCHAR wForm = wch; 687 FX_WCHAR wForm = wch;
688 if (dwType == FX_CHARTYPE_Numeric) { 688 if (dwType == FX_CHARTYPE_Numeric) {
689 if (m_bArabicNumber) { 689 if (m_bArabicNumber) {
690 wForm = wch + 0x0630; 690 wForm = wch + 0x0630;
691 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicIndic; 691 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicIndic;
692 } 692 }
(...skipping 19 matching lines...) Expand all
712 iCharWidth += m_iCharSpace; 712 iCharWidth += m_iCharSpace;
713 pCurChar->m_iCharWidth = iCharWidth; 713 pCurChar->m_iCharWidth = iCharWidth;
714 iLineWidth += iCharWidth; 714 iLineWidth += iCharWidth;
715 FX_BOOL bBreak = (dwType != FX_CHARTYPE_Space || 715 FX_BOOL bBreak = (dwType != FX_CHARTYPE_Space ||
716 (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0); 716 (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0);
717 if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) { 717 if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) {
718 return EndBreak(FX_TXTBREAK_LineBreak); 718 return EndBreak(FX_TXTBREAK_LineBreak);
719 } 719 }
720 return FX_TXTBREAK_None; 720 return FX_TXTBREAK_None;
721 } 721 }
722 typedef FX_DWORD (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)(CFX_Char* pCurChar, 722 typedef uint32_t (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)(CFX_Char* pCurChar,
723 int32_t iRotation); 723 int32_t iRotation);
724 static const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { 724 static const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = {
725 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Tab, 725 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Tab,
726 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Control, 726 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Control,
727 &CFX_TxtBreak::AppendChar_Combination, &CFX_TxtBreak::AppendChar_Others, 727 &CFX_TxtBreak::AppendChar_Combination, &CFX_TxtBreak::AppendChar_Others,
728 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Arabic, 728 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Arabic,
729 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic, 729 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic,
730 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic, 730 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Arabic,
731 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Others, 731 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Others,
732 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others, 732 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others,
733 }; 733 };
734 FX_DWORD CFX_TxtBreak::AppendChar(FX_WCHAR wch) { 734 uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
735 FX_DWORD dwProps = kTextLayoutCodeProperties[(uint16_t)wch]; 735 uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch];
736 FX_DWORD dwType = (dwProps & FX_CHARTYPEBITSMASK); 736 uint32_t dwType = (dwProps & FX_CHARTYPEBITSMASK);
737 CFX_TxtChar* pCurChar = m_pCurLine->m_pLineChars->AddSpace(); 737 CFX_TxtChar* pCurChar = m_pCurLine->m_pLineChars->AddSpace();
738 pCurChar->m_wCharCode = (uint16_t)wch; 738 pCurChar->m_wCharCode = (uint16_t)wch;
739 pCurChar->m_nRotation = m_iCharRotation; 739 pCurChar->m_nRotation = m_iCharRotation;
740 pCurChar->m_dwCharProps = dwProps; 740 pCurChar->m_dwCharProps = dwProps;
741 pCurChar->m_dwCharStyles = 0; 741 pCurChar->m_dwCharStyles = 0;
742 pCurChar->m_iCharWidth = 0; 742 pCurChar->m_iCharWidth = 0;
743 pCurChar->m_iHorizontalScale = m_iHorScale; 743 pCurChar->m_iHorizontalScale = m_iHorScale;
744 pCurChar->m_iVertialScale = m_iVerScale; 744 pCurChar->m_iVertialScale = m_iVerScale;
745 pCurChar->m_dwStatus = 0; 745 pCurChar->m_dwStatus = 0;
746 pCurChar->m_iBidiClass = 0; 746 pCurChar->m_iBidiClass = 0;
747 pCurChar->m_iBidiLevel = 0; 747 pCurChar->m_iBidiLevel = 0;
748 pCurChar->m_iBidiPos = 0; 748 pCurChar->m_iBidiPos = 0;
749 pCurChar->m_iBidiOrder = 0; 749 pCurChar->m_iBidiOrder = 0;
750 pCurChar->m_pUserData = NULL; 750 pCurChar->m_pUserData = NULL;
751 AppendChar_PageLoad(pCurChar, dwProps); 751 AppendChar_PageLoad(pCurChar, dwProps);
752 FX_DWORD dwRet1 = FX_TXTBREAK_None; 752 uint32_t dwRet1 = FX_TXTBREAK_None;
753 if (dwType != FX_CHARTYPE_Combination && 753 if (dwType != FX_CHARTYPE_Combination &&
754 GetUnifiedCharType(m_dwCharType) != GetUnifiedCharType(dwType)) { 754 GetUnifiedCharType(m_dwCharType) != GetUnifiedCharType(dwType)) {
755 if (m_dwCharType > 0 && 755 if (m_dwCharType > 0 &&
756 m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance && !m_bSingleLine) { 756 m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance && !m_bSingleLine) {
757 if (m_dwCharType != FX_CHARTYPE_Space || dwType != FX_CHARTYPE_Control) { 757 if (m_dwCharType != FX_CHARTYPE_Space || dwType != FX_CHARTYPE_Control) {
758 dwRet1 = EndBreak(FX_TXTBREAK_LineBreak); 758 dwRet1 = EndBreak(FX_TXTBREAK_LineBreak);
759 int32_t iCount = m_pCurLine->CountChars(); 759 int32_t iCount = m_pCurLine->CountChars();
760 if (iCount > 0) { 760 if (iCount > 0) {
761 pCurChar = m_pCurLine->m_pLineChars->GetDataPtr(iCount - 1); 761 pCurChar = m_pCurLine->m_pLineChars->GetDataPtr(iCount - 1);
762 } 762 }
763 } 763 }
764 } 764 }
765 } 765 }
766 int32_t iRotation = m_iRotation; 766 int32_t iRotation = m_iRotation;
767 if (m_bVertical && (dwProps & 0x8000) != 0) { 767 if (m_bVertical && (dwProps & 0x8000) != 0) {
768 iRotation = (iRotation + 1) % 4; 768 iRotation = (iRotation + 1) % 4;
769 } 769 }
770 FX_DWORD dwRet2 = 770 uint32_t dwRet2 =
771 (this->*g_FX_TxtBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])( 771 (this->*g_FX_TxtBreak_lpfAppendChar[dwType >> FX_CHARTYPEBITS])(
772 pCurChar, iRotation); 772 pCurChar, iRotation);
773 return std::max(dwRet1, dwRet2); 773 return std::max(dwRet1, dwRet2);
774 } 774 }
775 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { 775 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
776 FXSYS_assert(m_bArabicShapes); 776 FXSYS_assert(m_bArabicShapes);
777 int32_t iCount = m_pCurLine->CountChars(); 777 int32_t iCount = m_pCurLine->CountChars();
778 if (iCount < 2) { 778 if (iCount < 2) {
779 return; 779 return;
780 } 780 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 pCur->m_iCharWidth = iCharWidth; 818 pCur->m_iCharWidth = iCharWidth;
819 iLineWidth += iCharWidth; 819 iLineWidth += iCharWidth;
820 } 820 }
821 } 821 }
822 bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 822 bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
823 pCur = pNext; 823 pCur = pNext;
824 } while (i < iCount); 824 } while (i < iCount);
825 } 825 }
826 FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, 826 FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
827 FX_BOOL bAllChars, 827 FX_BOOL bAllChars,
828 FX_DWORD dwStatus) { 828 uint32_t dwStatus) {
829 int32_t iCount = m_pCurLine->CountChars(); 829 int32_t iCount = m_pCurLine->CountChars();
830 FX_BOOL bDone = FALSE; 830 FX_BOOL bDone = FALSE;
831 CFX_Char* pTC; 831 CFX_Char* pTC;
832 if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) { 832 if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) {
833 pTC = m_pCurLine->GetCharPtr(iCount - 1); 833 pTC = m_pCurLine->GetCharPtr(iCount - 1);
834 switch (pTC->GetCharType()) { 834 switch (pTC->GetCharType()) {
835 case FX_CHARTYPE_Tab: 835 case FX_CHARTYPE_Tab:
836 case FX_CHARTYPE_Control: 836 case FX_CHARTYPE_Control:
837 break; 837 break;
838 case FX_CHARTYPE_Space: 838 case FX_CHARTYPE_Space:
(...skipping 27 matching lines...) Expand all
866 m_pCurLine = pNextLine; 866 m_pCurLine = pNextLine;
867 m_dwCharType = 0; 867 m_dwCharType = 0;
868 return TRUE; 868 return TRUE;
869 } 869 }
870 if (bAllChars && !bDone) { 870 if (bAllChars && !bDone) {
871 int32_t iEndPos = m_pCurLine->m_iWidth; 871 int32_t iEndPos = m_pCurLine->m_iWidth;
872 GetBreakPos(*m_pCurLine->m_pLineChars, iEndPos, bAllChars, TRUE); 872 GetBreakPos(*m_pCurLine->m_pLineChars, iEndPos, bAllChars, TRUE);
873 } 873 }
874 return FALSE; 874 return FALSE;
875 } 875 }
876 void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, FX_DWORD dwStatus) { 876 void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
877 CFX_TxtPiece tp; 877 CFX_TxtPiece tp;
878 FX_TPO tpo; 878 FX_TPO tpo;
879 CFX_TxtChar* pTC; 879 CFX_TxtChar* pTC;
880 int32_t i, j; 880 int32_t i, j;
881 CFX_TxtCharArray& chars = *m_pCurLine->m_pLineChars; 881 CFX_TxtCharArray& chars = *m_pCurLine->m_pLineChars;
882 int32_t iCount = m_pCurLine->CountChars(); 882 int32_t iCount = m_pCurLine->CountChars();
883 FX_BOOL bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL); 883 FX_BOOL bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL);
884 if (!m_bPagination && bDone) { 884 if (!m_bPagination && bDone) {
885 int32_t iBidiNum = 0; 885 int32_t iBidiNum = 0;
886 for (i = 0; i < iCount; i++) { 886 for (i = 0; i < iCount; i++) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 tp.m_iHorizontalScale = pTC->m_iHorizontalScale; 976 tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
977 tp.m_iVerticalScale = pTC->m_iVertialScale; 977 tp.m_iVerticalScale = pTC->m_iVertialScale;
978 pCurPieces->Add(tp); 978 pCurPieces->Add(tp);
979 tpo.index = 0; 979 tpo.index = 0;
980 tpo.pos = 0; 980 tpo.pos = 0;
981 tpos.Add(tpo); 981 tpos.Add(tpo);
982 } 982 }
983 } 983 }
984 void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, 984 void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos,
985 FX_BOOL bAllChars, 985 FX_BOOL bAllChars,
986 FX_DWORD dwStatus) { 986 uint32_t dwStatus) {
987 int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth; 987 int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth;
988 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces; 988 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces;
989 int32_t i, j, iCount = pCurPieces->GetSize(); 989 int32_t i, j, iCount = pCurPieces->GetSize();
990 FX_BOOL bFind = FALSE; 990 FX_BOOL bFind = FALSE;
991 FX_TPO tpo; 991 FX_TPO tpo;
992 CFX_TxtChar* pTC; 992 CFX_TxtChar* pTC;
993 FX_DWORD dwCharType; 993 uint32_t dwCharType;
994 for (i = iCount - 1; i > -1; i--) { 994 for (i = iCount - 1; i > -1; i--) {
995 tpo = tpos.GetAt(i); 995 tpo = tpos.GetAt(i);
996 CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index); 996 CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index);
997 if (!bFind) { 997 if (!bFind) {
998 iNetWidth = ttp.GetEndPos(); 998 iNetWidth = ttp.GetEndPos();
999 } 999 }
1000 FX_BOOL bArabic = FX_IsOdd(ttp.m_iBidiLevel); 1000 FX_BOOL bArabic = FX_IsOdd(ttp.m_iBidiLevel);
1001 j = bArabic ? 0 : ttp.m_iChars - 1; 1001 j = bArabic ? 0 : ttp.m_iChars - 1;
1002 while (j > -1 && j < ttp.m_iChars) { 1002 while (j > -1 && j < ttp.m_iChars) {
1003 pTC = ttp.GetCharPtr(j); 1003 pTC = ttp.GetCharPtr(j);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 iOffset /= 2; 1064 iOffset /= 2;
1065 } 1065 }
1066 if (iOffset > 0) { 1066 if (iOffset > 0) {
1067 for (i = 0; i < iCount; i++) { 1067 for (i = 0; i < iCount; i++) {
1068 CFX_TxtPiece& ttp = pCurPieces->GetAt(i); 1068 CFX_TxtPiece& ttp = pCurPieces->GetAt(i);
1069 ttp.m_iStartPos += iOffset; 1069 ttp.m_iStartPos += iOffset;
1070 } 1070 }
1071 } 1071 }
1072 } 1072 }
1073 } 1073 }
1074 FX_DWORD CFX_TxtBreak::EndBreak(FX_DWORD dwStatus) { 1074 uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
1075 FXSYS_assert(dwStatus >= FX_TXTBREAK_PieceBreak && 1075 FXSYS_assert(dwStatus >= FX_TXTBREAK_PieceBreak &&
1076 dwStatus <= FX_TXTBREAK_PageBreak); 1076 dwStatus <= FX_TXTBREAK_PageBreak);
1077 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces; 1077 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces;
1078 int32_t iCount = pCurPieces->GetSize(); 1078 int32_t iCount = pCurPieces->GetSize();
1079 if (iCount > 0) { 1079 if (iCount > 0) {
1080 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount); 1080 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
1081 if (dwStatus > FX_TXTBREAK_PieceBreak) { 1081 if (dwStatus > FX_TXTBREAK_PieceBreak) {
1082 pLastPiece->m_dwStatus = dwStatus; 1082 pLastPiece->m_dwStatus = dwStatus;
1083 } else { 1083 } else {
1084 dwStatus = pLastPiece->m_dwStatus; 1084 dwStatus = pLastPiece->m_dwStatus;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 if (m_bSingleLine || iEndPos <= m_iLineWidth) { 1151 if (m_bSingleLine || iEndPos <= m_iLineWidth) {
1152 if (!bAllChars) { 1152 if (!bAllChars) {
1153 return iLength; 1153 return iLength;
1154 } 1154 }
1155 iBreak = iLength; 1155 iBreak = iLength;
1156 iBreakPos = iEndPos; 1156 iBreakPos = iEndPos;
1157 } 1157 }
1158 FX_BOOL bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0; 1158 FX_BOOL bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0;
1159 FX_BOOL bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0; 1159 FX_BOOL bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0;
1160 FX_LINEBREAKTYPE eType; 1160 FX_LINEBREAKTYPE eType;
1161 FX_DWORD nCodeProp, nCur, nNext; 1161 uint32_t nCodeProp, nCur, nNext;
1162 CFX_Char* pCur = ca.GetDataPtr(iLength--); 1162 CFX_Char* pCur = ca.GetDataPtr(iLength--);
1163 if (bAllChars) { 1163 if (bAllChars) {
1164 pCur->m_nBreakType = FX_LBT_UNKNOWN; 1164 pCur->m_nBreakType = FX_LBT_UNKNOWN;
1165 } 1165 }
1166 nCodeProp = pCur->m_dwCharProps; 1166 nCodeProp = pCur->m_dwCharProps;
1167 nNext = nCodeProp & 0x003F; 1167 nNext = nCodeProp & 0x003F;
1168 int32_t iCharWidth = pCur->m_iCharWidth; 1168 int32_t iCharWidth = pCur->m_iCharWidth;
1169 if (iCharWidth > 0) { 1169 if (iCharWidth > 0) {
1170 iEndPos -= iCharWidth; 1170 iEndPos -= iCharWidth;
1171 } 1171 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 FX_AdjustCharDisplayPos pAdjustPos) const { 1336 FX_AdjustCharDisplayPos pAdjustPos) const {
1337 if (pTxtRun == NULL || pTxtRun->iLength < 1) { 1337 if (pTxtRun == NULL || pTxtRun->iLength < 1) {
1338 return 0; 1338 return 0;
1339 } 1339 }
1340 IFX_TxtAccess* pAccess = pTxtRun->pAccess; 1340 IFX_TxtAccess* pAccess = pTxtRun->pAccess;
1341 void* pIdentity = pTxtRun->pIdentity; 1341 void* pIdentity = pTxtRun->pIdentity;
1342 const FX_WCHAR* pStr = pTxtRun->pStr; 1342 const FX_WCHAR* pStr = pTxtRun->pStr;
1343 int32_t* pWidths = pTxtRun->pWidths; 1343 int32_t* pWidths = pTxtRun->pWidths;
1344 int32_t iLength = pTxtRun->iLength - 1; 1344 int32_t iLength = pTxtRun->iLength - 1;
1345 IFX_Font* pFont = pTxtRun->pFont; 1345 IFX_Font* pFont = pTxtRun->pFont;
1346 FX_DWORD dwStyles = pTxtRun->dwStyles; 1346 uint32_t dwStyles = pTxtRun->dwStyles;
1347 CFX_RectF rtText(*pTxtRun->pRect); 1347 CFX_RectF rtText(*pTxtRun->pRect);
1348 FX_BOOL bRTLPiece = 1348 FX_BOOL bRTLPiece =
1349 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; 1349 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1350 FX_BOOL bArabicNumber = 1350 FX_BOOL bArabicNumber =
1351 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0; 1351 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
1352 FX_BOOL bArabicComma = 1352 FX_BOOL bArabicComma =
1353 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0; 1353 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0;
1354 FX_FLOAT fFontSize = pTxtRun->fFontSize; 1354 FX_FLOAT fFontSize = pTxtRun->fFontSize;
1355 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); 1355 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
1356 int32_t iAscent = pFont->GetAscent(); 1356 int32_t iAscent = pFont->GetAscent();
1357 int32_t iDescent = pFont->GetDescent(); 1357 int32_t iDescent = pFont->GetDescent();
1358 int32_t iMaxHeight = iAscent - iDescent; 1358 int32_t iMaxHeight = iAscent - iDescent;
1359 FX_FLOAT fFontHeight = fFontSize; 1359 FX_FLOAT fFontHeight = fFontSize;
1360 FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight; 1360 FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight;
1361 FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight; 1361 FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight;
1362 FX_BOOL bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; 1362 FX_BOOL bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0;
1363 FX_BOOL bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0; 1363 FX_BOOL bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0;
1364 int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation; 1364 int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation;
1365 int32_t iCharRotation; 1365 int32_t iCharRotation;
1366 FX_WCHAR wch, wPrev = 0xFEFF, wNext, wForm, wLast = 0xFEFF; 1366 FX_WCHAR wch, wPrev = 0xFEFF, wNext, wForm, wLast = 0xFEFF;
1367 int32_t iWidth, iCharWidth, iCharHeight; 1367 int32_t iWidth, iCharWidth, iCharHeight;
1368 FX_FLOAT fX, fY, fCharWidth, fCharHeight; 1368 FX_FLOAT fX, fY, fCharWidth, fCharHeight;
1369 int32_t iHorScale = pTxtRun->iHorizontalScale; 1369 int32_t iHorScale = pTxtRun->iHorizontalScale;
1370 int32_t iVerScale = pTxtRun->iVerticalScale; 1370 int32_t iVerScale = pTxtRun->iVerticalScale;
1371 FX_BOOL bSkipSpace = pTxtRun->bSkipSpace; 1371 FX_BOOL bSkipSpace = pTxtRun->bSkipSpace;
1372 FX_BOOL bEmptyChar, bShadda = FALSE, bLam = FALSE; 1372 FX_BOOL bEmptyChar, bShadda = FALSE, bLam = FALSE;
1373 FX_DWORD dwProps, dwCharType; 1373 uint32_t dwProps, dwCharType;
1374 FX_FORMCHAR formChars[3]; 1374 FX_FORMCHAR formChars[3];
1375 FX_FLOAT fYBase; 1375 FX_FLOAT fYBase;
1376 fX = rtText.left; 1376 fX = rtText.left;
1377 if (bVerticalDoc) { 1377 if (bVerticalDoc) {
1378 fX += (rtText.width - fFontSize) / 2.0f; 1378 fX += (rtText.width - fFontSize) / 2.0f;
1379 fYBase = bRTLPiece ? rtText.bottom() : rtText.top; 1379 fYBase = bRTLPiece ? rtText.bottom() : rtText.top;
1380 fY = fYBase; 1380 fY = fYBase;
1381 } else { 1381 } else {
1382 if (bRTLPiece) { 1382 if (bRTLPiece) {
1383 fX = rtText.right(); 1383 fX = rtText.right();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 } 1592 }
1593 if (dwCharType == FX_CHARTYPE_Combination) { 1593 if (dwCharType == FX_CHARTYPE_Combination) {
1594 CFX_Rect rtBBox; 1594 CFX_Rect rtBBox;
1595 rtBBox.Reset(); 1595 rtBBox.Reset();
1596 if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { 1596 if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) {
1597 pCharPos->m_OriginY = 1597 pCharPos->m_OriginY =
1598 fYBase + fFontSize - 1598 fYBase + fFontSize -
1599 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; 1599 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight;
1600 } 1600 }
1601 if (wForm == wch && wLast != 0xFEFF) { 1601 if (wForm == wch && wLast != 0xFEFF) {
1602 FX_DWORD dwLastProps = FX_GetUnicodeProperties(wLast); 1602 uint32_t dwLastProps = FX_GetUnicodeProperties(wLast);
1603 if ((dwLastProps & FX_CHARTYPEBITSMASK) == 1603 if ((dwLastProps & FX_CHARTYPEBITSMASK) ==
1604 FX_CHARTYPE_Combination) { 1604 FX_CHARTYPE_Combination) {
1605 CFX_Rect rtBBox; 1605 CFX_Rect rtBBox;
1606 rtBBox.Reset(); 1606 rtBBox.Reset();
1607 if (pFont->GetCharBBox(wLast, rtBBox, FALSE)) { 1607 if (pFont->GetCharBBox(wLast, rtBBox, FALSE)) {
1608 pCharPos->m_OriginY -= fFontSize * rtBBox.height / iMaxHeight; 1608 pCharPos->m_OriginY -= fFontSize * rtBBox.height / iMaxHeight;
1609 } 1609 }
1610 } 1610 }
1611 } 1611 }
1612 } 1612 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 rtBBoxF.height = fHeight; 1815 rtBBoxF.height = fHeight;
1816 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f); 1816 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
1817 } 1817 }
1818 rtArray.SetAt(i, rtBBoxF); 1818 rtArray.SetAt(i, rtBBoxF);
1819 continue; 1819 continue;
1820 } 1820 }
1821 rtArray.SetAt(i, rect); 1821 rtArray.SetAt(i, rect);
1822 } 1822 }
1823 return iLength; 1823 return iLength;
1824 } 1824 }
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698