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

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

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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_textbreak.h ('k') | xfa/fgas/layout/fgas_unicode.h » ('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 19 matching lines...) Expand all
30 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Others, 30 &CFX_TxtBreak::AppendChar_Arabic, &CFX_TxtBreak::AppendChar_Others,
31 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others, 31 &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others,
32 }; 32 };
33 33
34 } // namespace 34 } // namespace
35 35
36 CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) 36 CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
37 : m_dwPolicies(dwPolicies), 37 : m_dwPolicies(dwPolicies),
38 m_iLineWidth(2000000), 38 m_iLineWidth(2000000),
39 m_dwLayoutStyles(0), 39 m_dwLayoutStyles(0),
40 m_bVertical(FALSE), 40 m_bVertical(false),
41 m_bArabicContext(FALSE), 41 m_bArabicContext(false),
42 m_bArabicShapes(FALSE), 42 m_bArabicShapes(false),
43 m_bRTL(FALSE), 43 m_bRTL(false),
44 m_bSingleLine(FALSE), 44 m_bSingleLine(false),
45 m_bCombText(FALSE), 45 m_bCombText(false),
46 m_iArabicContext(1), 46 m_iArabicContext(1),
47 m_iCurArabicContext(1), 47 m_iCurArabicContext(1),
48 m_pFont(nullptr), 48 m_pFont(nullptr),
49 m_iFontSize(240), 49 m_iFontSize(240),
50 m_bEquidistant(TRUE), 50 m_bEquidistant(true),
51 m_iTabWidth(720000), 51 m_iTabWidth(720000),
52 m_wDefChar(0xFEFF), 52 m_wDefChar(0xFEFF),
53 m_wParagBreakChar(L'\n'), 53 m_wParagBreakChar(L'\n'),
54 m_iDefChar(0), 54 m_iDefChar(0),
55 m_iLineRotation(0), 55 m_iLineRotation(0),
56 m_iCharRotation(0), 56 m_iCharRotation(0),
57 m_iRotation(0), 57 m_iRotation(0),
58 m_iAlignment(FX_TXTLINEALIGNMENT_Left), 58 m_iAlignment(FX_TXTLINEALIGNMENT_Left),
59 m_dwContextCharStyles(0), 59 m_dwContextCharStyles(0),
60 m_iCombWidth(360000), 60 m_iCombWidth(360000),
61 m_pUserData(nullptr), 61 m_pUserData(nullptr),
62 m_eCharType(FX_CHARTYPE_Unknown), 62 m_eCharType(FX_CHARTYPE_Unknown),
63 m_bArabicNumber(FALSE), 63 m_bArabicNumber(false),
64 m_bArabicComma(FALSE), 64 m_bArabicComma(false),
65 m_pCurLine(nullptr), 65 m_pCurLine(nullptr),
66 m_iReady(0), 66 m_iReady(0),
67 m_iTolerance(0), 67 m_iTolerance(0),
68 m_iHorScale(100), 68 m_iHorScale(100),
69 m_iVerScale(100), 69 m_iVerScale(100),
70 m_iCharSpace(0) { 70 m_iCharSpace(0) {
71 m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0; 71 m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0;
72 int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar); 72 int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar);
73 m_pTxtLine1.reset(new CFX_TxtLine(iSize)); 73 m_pTxtLine1.reset(new CFX_TxtLine(iSize));
74 m_pTxtLine2.reset(new CFX_TxtLine(iSize)); 74 m_pTxtLine2.reset(new CFX_TxtLine(iSize));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (!pFont) { 115 if (!pFont) {
116 return; 116 return;
117 } 117 }
118 if (m_pFont == pFont) { 118 if (m_pFont == pFont) {
119 return; 119 return;
120 } 120 }
121 SetBreakStatus(); 121 SetBreakStatus();
122 m_pFont = pFont; 122 m_pFont = pFont;
123 m_iDefChar = 0; 123 m_iDefChar = 0;
124 if (m_wDefChar != 0xFEFF && m_pFont) { 124 if (m_wDefChar != 0xFEFF && m_pFont) {
125 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); 125 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
126 m_iDefChar *= m_iFontSize; 126 m_iDefChar *= m_iFontSize;
127 } 127 }
128 } 128 }
129 129
130 void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) { 130 void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) {
131 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); 131 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
132 if (m_iFontSize == iFontSize) { 132 if (m_iFontSize == iFontSize) {
133 return; 133 return;
134 } 134 }
135 SetBreakStatus(); 135 SetBreakStatus();
136 m_iFontSize = iFontSize; 136 m_iFontSize = iFontSize;
137 m_iDefChar = 0; 137 m_iDefChar = 0;
138 if (m_wDefChar != 0xFEFF && m_pFont) { 138 if (m_wDefChar != 0xFEFF && m_pFont) {
139 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); 139 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
140 m_iDefChar *= m_iFontSize; 140 m_iDefChar *= m_iFontSize;
141 } 141 }
142 } 142 }
143 143
144 void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { 144 void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) {
145 m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f); 145 m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
146 if (m_iTabWidth < FX_TXTBREAK_MinimumTabWidth) { 146 if (m_iTabWidth < FX_TXTBREAK_MinimumTabWidth) {
147 m_iTabWidth = FX_TXTBREAK_MinimumTabWidth; 147 m_iTabWidth = FX_TXTBREAK_MinimumTabWidth;
148 } 148 }
149 m_bEquidistant = bEquidistant; 149 m_bEquidistant = bEquidistant;
150 } 150 }
151 151
152 void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) { 152 void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) {
153 m_wDefChar = wch; 153 m_wDefChar = wch;
154 m_iDefChar = 0; 154 m_iDefChar = 0;
155 if (m_wDefChar != 0xFEFF && m_pFont) { 155 if (m_wDefChar != 0xFEFF && m_pFont) {
156 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE); 156 m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, false);
157 if (m_iDefChar < 0) { 157 if (m_iDefChar < 0) {
158 m_iDefChar = 0; 158 m_iDefChar = 0;
159 } else { 159 } else {
160 m_iDefChar *= m_iFontSize; 160 m_iDefChar *= m_iFontSize;
161 } 161 }
162 } 162 }
163 } 163 }
164 164
165 void CFX_TxtBreak::SetParagraphBreakChar(FX_WCHAR wch) { 165 void CFX_TxtBreak::SetParagraphBreakChar(FX_WCHAR wch) {
166 if (wch != L'\r' && wch != L'\n') { 166 if (wch != L'\r' && wch != L'\n') {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) { 273 void CFX_TxtBreak::SetCharSpace(FX_FLOAT fCharSpace) {
274 m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); 274 m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f);
275 } 275 }
276 276
277 static const int32_t gs_FX_TxtLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2}; 277 static const int32_t gs_FX_TxtLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2};
278 int32_t CFX_TxtBreak::GetLineRotation(uint32_t dwStyles) const { 278 int32_t CFX_TxtBreak::GetLineRotation(uint32_t dwStyles) const {
279 return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1]; 279 return gs_FX_TxtLineRotations[(dwStyles & 0x0E) >> 1];
280 } 280 }
281 281
282 CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const { 282 CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, bool bOmitChar) const {
283 CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars.get(); 283 CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars.get();
284 int32_t iCount = ca.GetSize(); 284 int32_t iCount = ca.GetSize();
285 if (index < 0 || index >= iCount) { 285 if (index < 0 || index >= iCount) {
286 return nullptr; 286 return nullptr;
287 } 287 }
288 CFX_TxtChar* pTC; 288 CFX_TxtChar* pTC;
289 int32_t iStart = iCount - 1; 289 int32_t iStart = iCount - 1;
290 while (iStart > -1) { 290 while (iStart > -1) {
291 pTC = ca.GetDataPtr(iStart--); 291 pTC = ca.GetDataPtr(iStart--);
292 if (bOmitChar && pTC->GetCharType() == FX_CHARTYPE_Combination) { 292 if (bOmitChar && pTC->GetCharType() == FX_CHARTYPE_Combination) {
293 continue; 293 continue;
294 } 294 }
295 if (--index < 0) { 295 if (--index < 0) {
296 return pTC; 296 return pTC;
297 } 297 }
298 } 298 }
299 return nullptr; 299 return nullptr;
300 } 300 }
301 301
302 CFX_TxtLine* CFX_TxtBreak::GetTxtLine(FX_BOOL bReady) const { 302 CFX_TxtLine* CFX_TxtBreak::GetTxtLine(bool bReady) const {
303 if (!bReady) 303 if (!bReady)
304 return m_pCurLine; 304 return m_pCurLine;
305 if (m_iReady == 1) 305 if (m_iReady == 1)
306 return m_pTxtLine1.get(); 306 return m_pTxtLine1.get();
307 if (m_iReady == 2) 307 if (m_iReady == 2)
308 return m_pTxtLine2.get(); 308 return m_pTxtLine2.get();
309 return nullptr; 309 return nullptr;
310 } 310 }
311 311
312 CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const { 312 CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(bool bReady) const {
313 CFX_TxtLine* pTxtLine = GetTxtLine(bReady); 313 CFX_TxtLine* pTxtLine = GetTxtLine(bReady);
314 if (!pTxtLine) { 314 if (!pTxtLine) {
315 return nullptr; 315 return nullptr;
316 } 316 }
317 return pTxtLine->m_pLinePieces.get(); 317 return pTxtLine->m_pLinePieces.get();
318 } 318 }
319 319
320 inline FX_CHARTYPE CFX_TxtBreak::GetUnifiedCharType( 320 inline FX_CHARTYPE CFX_TxtBreak::GetUnifiedCharType(
321 FX_CHARTYPE chartype) const { 321 FX_CHARTYPE chartype) const {
322 return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype; 322 return chartype >= FX_CHARTYPE_ArabicAlef ? FX_CHARTYPE_Arabic : chartype;
323 } 323 }
324 324
325 void CFX_TxtBreak::ResetArabicContext() { 325 void CFX_TxtBreak::ResetArabicContext() {
326 if (m_bArabicContext) { 326 if (m_bArabicContext) {
327 m_bCurRTL = m_iCurArabicContext > 1; 327 m_bCurRTL = m_iCurArabicContext > 1;
328 m_iCurAlignment = m_iCurArabicContext > 1 ? FX_TXTLINEALIGNMENT_Right 328 m_iCurAlignment = m_iCurArabicContext > 1 ? FX_TXTLINEALIGNMENT_Right
329 : FX_TXTLINEALIGNMENT_Left; 329 : FX_TXTLINEALIGNMENT_Left;
330 m_iCurAlignment |= (m_iAlignment & FX_TXTLINEALIGNMENT_HigherMask); 330 m_iCurAlignment |= (m_iAlignment & FX_TXTLINEALIGNMENT_HigherMask);
331 m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes; 331 m_bArabicNumber = m_iArabicContext >= 1 && m_bArabicShapes;
332 } else { 332 } else {
333 if (m_bPagination) { 333 if (m_bPagination) {
334 m_bCurRTL = FALSE; 334 m_bCurRTL = false;
335 m_iCurAlignment = 0; 335 m_iCurAlignment = 0;
336 } else { 336 } else {
337 m_bCurRTL = m_bRTL; 337 m_bCurRTL = m_bRTL;
338 m_iCurAlignment = m_iAlignment; 338 m_iCurAlignment = m_iAlignment;
339 } 339 }
340 if (m_bRTL) { 340 if (m_bRTL) {
341 m_bArabicNumber = m_iArabicContext >= 1; 341 m_bArabicNumber = m_iArabicContext >= 1;
342 } else { 342 } else {
343 m_bArabicNumber = m_iArabicContext > 1; 343 m_bArabicNumber = m_iArabicContext > 1;
344 } 344 }
(...skipping 16 matching lines...) Expand all
361 ? 2 361 ? 2
362 : ((iBidiCls == FX_BIDICLASS_L || iBidiCls == FX_BIDICLASS_S) ? 0 362 : ((iBidiCls == FX_BIDICLASS_L || iBidiCls == FX_BIDICLASS_S) ? 0
363 : 1); 363 : 1);
364 if (iArabicContext != m_iArabicContext && iArabicContext != 1) { 364 if (iArabicContext != m_iArabicContext && iArabicContext != 1) {
365 m_iArabicContext = iArabicContext; 365 m_iArabicContext = iArabicContext;
366 if (m_iCurArabicContext == 1) { 366 if (m_iCurArabicContext == 1) {
367 m_iCurArabicContext = iArabicContext; 367 m_iCurArabicContext = iArabicContext;
368 } 368 }
369 ResetArabicContext(); 369 ResetArabicContext();
370 if (!m_bPagination) { 370 if (!m_bPagination) {
371 CFX_TxtChar* pLastChar = GetLastChar(1, FALSE); 371 CFX_TxtChar* pLastChar = GetLastChar(1, false);
372 if (pLastChar && pLastChar->m_dwStatus < 1) { 372 if (pLastChar && pLastChar->m_dwStatus < 1) {
373 pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak; 373 pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak;
374 } 374 }
375 } 375 }
376 } 376 }
377 } 377 }
378 pCurChar->m_dwCharStyles = m_dwContextCharStyles; 378 pCurChar->m_dwCharStyles = m_dwContextCharStyles;
379 } 379 }
380 380
381 uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar, 381 uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar,
382 int32_t iRotation) { 382 int32_t iRotation) {
383 FX_WCHAR wch = pCurChar->m_wCharCode; 383 FX_WCHAR wch = pCurChar->m_wCharCode;
384 FX_WCHAR wForm; 384 FX_WCHAR wForm;
385 int32_t iCharWidth = 0; 385 int32_t iCharWidth = 0;
386 pCurChar->m_iCharWidth = -1; 386 pCurChar->m_iCharWidth = -1;
387 if (m_bCombText) { 387 if (m_bCombText) {
388 iCharWidth = m_iCombWidth; 388 iCharWidth = m_iCombWidth;
389 } else { 389 } else {
390 if (m_bVertical != FX_IsOdd(iRotation)) { 390 if (m_bVertical != FX_IsOdd(iRotation)) {
391 iCharWidth = 1000; 391 iCharWidth = 1000;
392 } else { 392 } else {
393 wForm = wch; 393 wForm = wch;
394 if (!m_bPagination) { 394 if (!m_bPagination) {
395 CFX_TxtChar* pLastChar = GetLastChar(0, FALSE); 395 CFX_TxtChar* pLastChar = GetLastChar(0, false);
396 if (pLastChar && 396 if (pLastChar &&
397 (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) { 397 (pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
398 FX_BOOL bShadda = FALSE; 398 bool bShadda = false;
399 if (wch == 0x0651) { 399 if (wch == 0x0651) {
400 FX_WCHAR wLast = pLastChar->m_wCharCode; 400 FX_WCHAR wLast = pLastChar->m_wCharCode;
401 if (wLast >= 0x064C && wLast <= 0x0650) { 401 if (wLast >= 0x064C && wLast <= 0x0650) {
402 wForm = FX_GetArabicFromShaddaTable(wLast); 402 wForm = FX_GetArabicFromShaddaTable(wLast);
403 bShadda = TRUE; 403 bShadda = true;
404 } 404 }
405 } else if (wch >= 0x064C && wch <= 0x0650) { 405 } else if (wch >= 0x064C && wch <= 0x0650) {
406 if (pLastChar->m_wCharCode == 0x0651) { 406 if (pLastChar->m_wCharCode == 0x0651) {
407 wForm = FX_GetArabicFromShaddaTable(wch); 407 wForm = FX_GetArabicFromShaddaTable(wch);
408 bShadda = TRUE; 408 bShadda = true;
409 } 409 }
410 } 410 }
411 if (bShadda) { 411 if (bShadda) {
412 pLastChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda; 412 pLastChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
413 pLastChar->m_iCharWidth = 0; 413 pLastChar->m_iCharWidth = 0;
414 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda; 414 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicShadda;
415 } 415 }
416 } 416 }
417 } 417 }
418 if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { 418 if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) {
419 iCharWidth = 0; 419 iCharWidth = 0;
420 } 420 }
421 } 421 }
422 iCharWidth *= m_iFontSize; 422 iCharWidth *= m_iFontSize;
423 iCharWidth = iCharWidth * m_iHorScale / 100; 423 iCharWidth = iCharWidth * m_iHorScale / 100;
424 } 424 }
425 pCurChar->m_iCharWidth = -iCharWidth; 425 pCurChar->m_iCharWidth = -iCharWidth;
426 return FX_TXTBREAK_None; 426 return FX_TXTBREAK_None;
427 } 427 }
428 428
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 return dwRet; 485 return dwRet;
486 } 486 }
487 487
488 uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar, 488 uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
489 int32_t iRotation) { 489 int32_t iRotation) {
490 FX_CHARTYPE chartype = pCurChar->GetCharType(); 490 FX_CHARTYPE chartype = pCurChar->GetCharType();
491 int32_t& iLineWidth = m_pCurLine->m_iWidth; 491 int32_t& iLineWidth = m_pCurLine->m_iWidth;
492 FX_WCHAR wForm; 492 FX_WCHAR wForm;
493 int32_t iCharWidth = 0; 493 int32_t iCharWidth = 0;
494 CFX_Char* pLastChar = nullptr; 494 CFX_Char* pLastChar = nullptr;
495 FX_BOOL bAlef = FALSE; 495 bool bAlef = false;
496 if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef && 496 if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef &&
497 m_eCharType <= FX_CHARTYPE_ArabicDistortion) { 497 m_eCharType <= FX_CHARTYPE_ArabicDistortion) {
498 pLastChar = GetLastChar(1); 498 pLastChar = GetLastChar(1);
499 if (pLastChar) { 499 if (pLastChar) {
500 iCharWidth = pLastChar->m_iCharWidth; 500 iCharWidth = pLastChar->m_iCharWidth;
501 if (iCharWidth > 0) { 501 if (iCharWidth > 0) {
502 iLineWidth -= iCharWidth; 502 iLineWidth -= iCharWidth;
503 } 503 }
504 CFX_Char* pPrevChar = GetLastChar(2); 504 CFX_Char* pPrevChar = GetLastChar(2);
505 wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar); 505 wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
506 bAlef = (wForm == 0xFEFF && 506 bAlef = (wForm == 0xFEFF &&
507 pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef); 507 pLastChar->GetCharType() == FX_CHARTYPE_ArabicAlef);
508 int32_t iLastRotation = pLastChar->m_nRotation + m_iLineRotation; 508 int32_t iLastRotation = pLastChar->m_nRotation + m_iLineRotation;
509 if (m_bVertical && (pLastChar->m_dwCharProps & 0x8000) != 0) { 509 if (m_bVertical && (pLastChar->m_dwCharProps & 0x8000) != 0) {
510 iLastRotation++; 510 iLastRotation++;
511 } 511 }
512 if (m_bVertical != FX_IsOdd(iLastRotation)) { 512 if (m_bVertical != FX_IsOdd(iLastRotation)) {
513 iCharWidth = 1000; 513 iCharWidth = 1000;
514 } else { 514 } else {
515 m_pFont->GetCharWidth(wForm, iCharWidth, FALSE); 515 m_pFont->GetCharWidth(wForm, iCharWidth, false);
516 } 516 }
517 if (wForm == 0xFEFF) { 517 if (wForm == 0xFEFF) {
518 iCharWidth = m_iDefChar; 518 iCharWidth = m_iDefChar;
519 } 519 }
520 iCharWidth *= m_iFontSize; 520 iCharWidth *= m_iFontSize;
521 iCharWidth = iCharWidth * m_iHorScale / 100; 521 iCharWidth = iCharWidth * m_iHorScale / 100;
522 pLastChar->m_iCharWidth = iCharWidth; 522 pLastChar->m_iCharWidth = iCharWidth;
523 iLineWidth += iCharWidth; 523 iLineWidth += iCharWidth;
524 iCharWidth = 0; 524 iCharWidth = 0;
525 } 525 }
526 } 526 }
527 m_eCharType = chartype; 527 m_eCharType = chartype;
528 wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar, 528 wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar,
529 nullptr); 529 nullptr);
530 if (m_bCombText) { 530 if (m_bCombText) {
531 iCharWidth = m_iCombWidth; 531 iCharWidth = m_iCombWidth;
532 } else { 532 } else {
533 if (m_bVertical != FX_IsOdd(iRotation)) { 533 if (m_bVertical != FX_IsOdd(iRotation)) {
534 iCharWidth = 1000; 534 iCharWidth = 1000;
535 } else { 535 } else {
536 m_pFont->GetCharWidth(wForm, iCharWidth, FALSE); 536 m_pFont->GetCharWidth(wForm, iCharWidth, false);
537 } 537 }
538 if (wForm == 0xFEFF) { 538 if (wForm == 0xFEFF) {
539 iCharWidth = m_iDefChar; 539 iCharWidth = m_iDefChar;
540 } 540 }
541 iCharWidth *= m_iFontSize; 541 iCharWidth *= m_iFontSize;
542 iCharWidth = iCharWidth * m_iHorScale / 100; 542 iCharWidth = iCharWidth * m_iHorScale / 100;
543 } 543 }
544 pCurChar->m_iCharWidth = iCharWidth; 544 pCurChar->m_iCharWidth = iCharWidth;
545 iLineWidth += iCharWidth; 545 iLineWidth += iCharWidth;
546 m_pCurLine->m_iArabicChars++; 546 m_pCurLine->m_iArabicChars++;
(...skipping 23 matching lines...) Expand all
570 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicComma; 570 pCurChar->m_dwCharStyles |= FX_TXTCHARSTYLE_ArabicComma;
571 } 571 }
572 } else if (m_bCurRTL || m_bVertical) { 572 } else if (m_bCurRTL || m_bVertical) {
573 wForm = FX_GetMirrorChar(wch, dwProps, m_bCurRTL, m_bVertical); 573 wForm = FX_GetMirrorChar(wch, dwProps, m_bCurRTL, m_bVertical);
574 } 574 }
575 if (m_bCombText) { 575 if (m_bCombText) {
576 iCharWidth = m_iCombWidth; 576 iCharWidth = m_iCombWidth;
577 } else { 577 } else {
578 if (m_bVertical != FX_IsOdd(iRotation)) { 578 if (m_bVertical != FX_IsOdd(iRotation)) {
579 iCharWidth = 1000; 579 iCharWidth = 1000;
580 } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { 580 } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) {
581 iCharWidth = m_iDefChar; 581 iCharWidth = m_iDefChar;
582 } 582 }
583 iCharWidth *= m_iFontSize; 583 iCharWidth *= m_iFontSize;
584 iCharWidth = iCharWidth * m_iHorScale / 100; 584 iCharWidth = iCharWidth * m_iHorScale / 100;
585 } 585 }
586 iCharWidth += m_iCharSpace; 586 iCharWidth += m_iCharSpace;
587 pCurChar->m_iCharWidth = iCharWidth; 587 pCurChar->m_iCharWidth = iCharWidth;
588 iLineWidth += iCharWidth; 588 iLineWidth += iCharWidth;
589 FX_BOOL bBreak = (chartype != FX_CHARTYPE_Space || 589 bool bBreak = (chartype != FX_CHARTYPE_Space ||
590 (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0); 590 (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0);
591 if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) { 591 if (!m_bSingleLine && bBreak && iLineWidth > m_iLineWidth + m_iTolerance) {
592 return EndBreak(FX_TXTBREAK_LineBreak); 592 return EndBreak(FX_TXTBREAK_LineBreak);
593 } 593 }
594 return FX_TXTBREAK_None; 594 return FX_TXTBREAK_None;
595 } 595 }
596 596
597 uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) { 597 uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
598 uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch]; 598 uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch];
599 FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps); 599 FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
600 CFX_TxtChar* pCurChar = m_pCurLine->m_pLineChars->AddSpace(); 600 CFX_TxtChar* pCurChar = m_pCurLine->m_pLineChars->AddSpace();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 638
639 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() { 639 void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
640 ASSERT(m_bArabicShapes); 640 ASSERT(m_bArabicShapes);
641 int32_t iCount = m_pCurLine->CountChars(); 641 int32_t iCount = m_pCurLine->CountChars();
642 if (iCount < 2) { 642 if (iCount < 2) {
643 return; 643 return;
644 } 644 }
645 int32_t& iLineWidth = m_pCurLine->m_iWidth; 645 int32_t& iLineWidth = m_pCurLine->m_iWidth;
646 CFX_Char* pCur = m_pCurLine->GetCharPtr(0); 646 CFX_Char* pCur = m_pCurLine->GetCharPtr(0);
647 FX_BOOL bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 647 bool bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
648 pCur = m_pCurLine->GetCharPtr(1); 648 pCur = m_pCurLine->GetCharPtr(1);
649 FX_WCHAR wch, wForm; 649 FX_WCHAR wch, wForm;
650 FX_BOOL bNextNum; 650 bool bNextNum;
651 int32_t i = 1; 651 int32_t i = 1;
652 int32_t iCharWidth; 652 int32_t iCharWidth;
653 int32_t iRotation; 653 int32_t iRotation;
654 CFX_Char* pNext; 654 CFX_Char* pNext;
655 do { 655 do {
656 i++; 656 i++;
657 if (i < iCount) { 657 if (i < iCount) {
658 pNext = m_pCurLine->GetCharPtr(i); 658 pNext = m_pCurLine->GetCharPtr(i);
659 bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 659 bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
660 } else { 660 } else {
661 pNext = nullptr; 661 pNext = nullptr;
662 bNextNum = FALSE; 662 bNextNum = false;
663 } 663 }
664 wch = pCur->m_wCharCode; 664 wch = pCur->m_wCharCode;
665 if (wch == L'.') { 665 if (wch == L'.') {
666 if (bPrevNum && bNextNum) { 666 if (bPrevNum && bNextNum) {
667 iRotation = m_iRotation; 667 iRotation = m_iRotation;
668 if (m_bVertical && (pCur->m_dwCharProps & 0x8000) != 0) { 668 if (m_bVertical && (pCur->m_dwCharProps & 0x8000) != 0) {
669 iRotation = ((iRotation + 1) & 0x03); 669 iRotation = ((iRotation + 1) & 0x03);
670 } 670 }
671 wForm = wch == L'.' ? 0x066B : 0x066C; 671 wForm = wch == L'.' ? 0x066B : 0x066C;
672 iLineWidth -= pCur->m_iCharWidth; 672 iLineWidth -= pCur->m_iCharWidth;
673 if (m_bCombText) { 673 if (m_bCombText) {
674 iCharWidth = m_iCombWidth; 674 iCharWidth = m_iCombWidth;
675 } else { 675 } else {
676 if (m_bVertical != FX_IsOdd(iRotation)) { 676 if (m_bVertical != FX_IsOdd(iRotation)) {
677 iCharWidth = 1000; 677 iCharWidth = 1000;
678 } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, FALSE)) { 678 } else if (!m_pFont->GetCharWidth(wForm, iCharWidth, false)) {
679 iCharWidth = m_iDefChar; 679 iCharWidth = m_iDefChar;
680 } 680 }
681 iCharWidth *= m_iFontSize; 681 iCharWidth *= m_iFontSize;
682 iCharWidth = iCharWidth * m_iHorScale / 100; 682 iCharWidth = iCharWidth * m_iHorScale / 100;
683 } 683 }
684 pCur->m_iCharWidth = iCharWidth; 684 pCur->m_iCharWidth = iCharWidth;
685 iLineWidth += iCharWidth; 685 iLineWidth += iCharWidth;
686 } 686 }
687 } 687 }
688 bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0; 688 bPrevNum = (pCur->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
689 pCur = pNext; 689 pCur = pNext;
690 } while (i < iCount); 690 } while (i < iCount);
691 } 691 }
692 692
693 FX_BOOL CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, 693 bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
694 FX_BOOL bAllChars, 694 bool bAllChars,
695 uint32_t dwStatus) { 695 uint32_t dwStatus) {
696 int32_t iCount = m_pCurLine->CountChars(); 696 int32_t iCount = m_pCurLine->CountChars();
697 FX_BOOL bDone = FALSE; 697 bool bDone = false;
698 CFX_Char* pTC; 698 CFX_Char* pTC;
699 if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) { 699 if (!m_bSingleLine && m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance) {
700 pTC = m_pCurLine->GetCharPtr(iCount - 1); 700 pTC = m_pCurLine->GetCharPtr(iCount - 1);
701 switch (pTC->GetCharType()) { 701 switch (pTC->GetCharType()) {
702 case FX_CHARTYPE_Tab: 702 case FX_CHARTYPE_Tab:
703 case FX_CHARTYPE_Control: 703 case FX_CHARTYPE_Control:
704 break; 704 break;
705 case FX_CHARTYPE_Space: 705 case FX_CHARTYPE_Space:
706 if ((m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0) { 706 if ((m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0) {
707 SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); 707 SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars);
708 bDone = TRUE; 708 bDone = true;
709 } 709 }
710 break; 710 break;
711 default: 711 default:
712 SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); 712 SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars);
713 bDone = TRUE; 713 bDone = true;
714 break; 714 break;
715 } 715 }
716 } 716 }
717 iCount = m_pCurLine->CountChars(); 717 iCount = m_pCurLine->CountChars();
718 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get(); 718 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
719 CFX_TxtPiece tp; 719 CFX_TxtPiece tp;
720 if (m_bPagination) { 720 if (m_bPagination) {
721 tp.m_dwStatus = dwStatus; 721 tp.m_dwStatus = dwStatus;
722 tp.m_iStartPos = m_pCurLine->m_iStart; 722 tp.m_iStartPos = m_pCurLine->m_iStart;
723 tp.m_iWidth = m_pCurLine->m_iWidth; 723 tp.m_iWidth = m_pCurLine->m_iWidth;
724 tp.m_iStartChar = 0; 724 tp.m_iStartChar = 0;
725 tp.m_iChars = iCount; 725 tp.m_iChars = iCount;
726 tp.m_pChars = m_pCurLine->m_pLineChars.get(); 726 tp.m_pChars = m_pCurLine->m_pLineChars.get();
727 tp.m_pUserData = m_pUserData; 727 tp.m_pUserData = m_pUserData;
728 pTC = m_pCurLine->GetCharPtr(0); 728 pTC = m_pCurLine->GetCharPtr(0);
729 tp.m_dwCharStyles = pTC->m_dwCharStyles; 729 tp.m_dwCharStyles = pTC->m_dwCharStyles;
730 tp.m_iHorizontalScale = pTC->m_iHorizontalScale; 730 tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
731 tp.m_iVerticalScale = pTC->m_iVertialScale; 731 tp.m_iVerticalScale = pTC->m_iVertialScale;
732 pCurPieces->Add(tp); 732 pCurPieces->Add(tp);
733 m_pCurLine = pNextLine; 733 m_pCurLine = pNextLine;
734 m_eCharType = FX_CHARTYPE_Unknown; 734 m_eCharType = FX_CHARTYPE_Unknown;
735 return TRUE; 735 return true;
736 } 736 }
737 if (bAllChars && !bDone) { 737 if (bAllChars && !bDone) {
738 int32_t iEndPos = m_pCurLine->m_iWidth; 738 int32_t iEndPos = m_pCurLine->m_iWidth;
739 GetBreakPos(*m_pCurLine->m_pLineChars.get(), iEndPos, bAllChars, TRUE); 739 GetBreakPos(*m_pCurLine->m_pLineChars.get(), iEndPos, bAllChars, true);
740 } 740 }
741 return FALSE; 741 return false;
742 } 742 }
743 743
744 void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) { 744 void CFX_TxtBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
745 CFX_TxtPiece tp; 745 CFX_TxtPiece tp;
746 FX_TPO tpo; 746 FX_TPO tpo;
747 CFX_TxtChar* pTC; 747 CFX_TxtChar* pTC;
748 int32_t i, j; 748 int32_t i, j;
749 CFX_TxtCharArray& chars = *m_pCurLine->m_pLineChars.get(); 749 CFX_TxtCharArray& chars = *m_pCurLine->m_pLineChars.get();
750 int32_t iCount = m_pCurLine->CountChars(); 750 int32_t iCount = m_pCurLine->CountChars();
751 FX_BOOL bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL); 751 bool bDone = (m_pCurLine->m_iArabicChars > 0 || m_bCurRTL);
752 if (!m_bPagination && bDone) { 752 if (!m_bPagination && bDone) {
753 int32_t iBidiNum = 0; 753 int32_t iBidiNum = 0;
754 for (i = 0; i < iCount; i++) { 754 for (i = 0; i < iCount; i++) {
755 pTC = chars.GetDataPtr(i); 755 pTC = chars.GetDataPtr(i);
756 pTC->m_iBidiPos = i; 756 pTC->m_iBidiPos = i;
757 if (pTC->GetCharType() != FX_CHARTYPE_Control) { 757 if (pTC->GetCharType() != FX_CHARTYPE_Control) {
758 iBidiNum = i; 758 iBidiNum = i;
759 } 759 }
760 if (i == 0) { 760 if (i == 0) {
761 pTC->m_iBidiLevel = 1; 761 pTC->m_iBidiLevel = 1;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 tp.m_iHorizontalScale = pTC->m_iHorizontalScale; 844 tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
845 tp.m_iVerticalScale = pTC->m_iVertialScale; 845 tp.m_iVerticalScale = pTC->m_iVertialScale;
846 pCurPieces->Add(tp); 846 pCurPieces->Add(tp);
847 tpo.index = 0; 847 tpo.index = 0;
848 tpo.pos = 0; 848 tpo.pos = 0;
849 tpos.Add(tpo); 849 tpos.Add(tpo);
850 } 850 }
851 } 851 }
852 852
853 void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos, 853 void CFX_TxtBreak::EndBreak_Alignment(CFX_TPOArray& tpos,
854 FX_BOOL bAllChars, 854 bool bAllChars,
855 uint32_t dwStatus) { 855 uint32_t dwStatus) {
856 int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth; 856 int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth;
857 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get(); 857 CFX_TxtPieceArray* pCurPieces = m_pCurLine->m_pLinePieces.get();
858 int32_t i, j, iCount = pCurPieces->GetSize(); 858 int32_t i, j, iCount = pCurPieces->GetSize();
859 FX_BOOL bFind = FALSE; 859 bool bFind = false;
860 FX_TPO tpo; 860 FX_TPO tpo;
861 CFX_TxtChar* pTC; 861 CFX_TxtChar* pTC;
862 FX_CHARTYPE chartype; 862 FX_CHARTYPE chartype;
863 for (i = iCount - 1; i > -1; i--) { 863 for (i = iCount - 1; i > -1; i--) {
864 tpo = tpos.GetAt(i); 864 tpo = tpos.GetAt(i);
865 CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index); 865 CFX_TxtPiece& ttp = pCurPieces->GetAt(tpo.index);
866 if (!bFind) { 866 if (!bFind) {
867 iNetWidth = ttp.GetEndPos(); 867 iNetWidth = ttp.GetEndPos();
868 } 868 }
869 FX_BOOL bArabic = FX_IsOdd(ttp.m_iBidiLevel); 869 bool bArabic = FX_IsOdd(ttp.m_iBidiLevel);
870 j = bArabic ? 0 : ttp.m_iChars - 1; 870 j = bArabic ? 0 : ttp.m_iChars - 1;
871 while (j > -1 && j < ttp.m_iChars) { 871 while (j > -1 && j < ttp.m_iChars) {
872 pTC = ttp.GetCharPtr(j); 872 pTC = ttp.GetCharPtr(j);
873 if (pTC->m_nBreakType == FX_LBT_DIRECT_BRK) { 873 if (pTC->m_nBreakType == FX_LBT_DIRECT_BRK) {
874 iGapChars++; 874 iGapChars++;
875 } 875 }
876 if (!bFind || !bAllChars) { 876 if (!bFind || !bAllChars) {
877 chartype = pTC->GetCharType(); 877 chartype = pTC->GetCharType();
878 if (chartype == FX_CHARTYPE_Space || chartype == FX_CHARTYPE_Control) { 878 if (chartype == FX_CHARTYPE_Space || chartype == FX_CHARTYPE_Control) {
879 if (!bFind) { 879 if (!bFind) {
880 iCharWidth = pTC->m_iCharWidth; 880 iCharWidth = pTC->m_iCharWidth;
881 if (bAllChars && iCharWidth > 0) { 881 if (bAllChars && iCharWidth > 0) {
882 iNetWidth -= iCharWidth; 882 iNetWidth -= iCharWidth;
883 } 883 }
884 } 884 }
885 } else { 885 } else {
886 bFind = TRUE; 886 bFind = true;
887 if (!bAllChars) { 887 if (!bAllChars) {
888 break; 888 break;
889 } 889 }
890 } 890 }
891 } 891 }
892 j += bArabic ? 1 : -1; 892 j += bArabic ? 1 : -1;
893 } 893 }
894 if (!bAllChars && bFind) { 894 if (!bAllChars && bFind) {
895 break; 895 break;
896 } 896 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 int32_t iCount = pCurPieces->GetSize(); 947 int32_t iCount = pCurPieces->GetSize();
948 if (iCount > 0) { 948 if (iCount > 0) {
949 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount); 949 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
950 if (dwStatus > FX_TXTBREAK_PieceBreak) { 950 if (dwStatus > FX_TXTBREAK_PieceBreak) {
951 pLastPiece->m_dwStatus = dwStatus; 951 pLastPiece->m_dwStatus = dwStatus;
952 } else { 952 } else {
953 dwStatus = pLastPiece->m_dwStatus; 953 dwStatus = pLastPiece->m_dwStatus;
954 } 954 }
955 return dwStatus; 955 return dwStatus;
956 } else { 956 } else {
957 CFX_TxtLine* pLastLine = GetTxtLine(TRUE); 957 CFX_TxtLine* pLastLine = GetTxtLine(true);
958 if (pLastLine) { 958 if (pLastLine) {
959 pCurPieces = pLastLine->m_pLinePieces.get(); 959 pCurPieces = pLastLine->m_pLinePieces.get();
960 iCount = pCurPieces->GetSize(); 960 iCount = pCurPieces->GetSize();
961 if (iCount-- > 0) { 961 if (iCount-- > 0) {
962 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(iCount); 962 CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(iCount);
963 if (dwStatus > FX_TXTBREAK_PieceBreak) { 963 if (dwStatus > FX_TXTBREAK_PieceBreak) {
964 pLastPiece->m_dwStatus = dwStatus; 964 pLastPiece->m_dwStatus = dwStatus;
965 } else { 965 } else {
966 dwStatus = pLastPiece->m_dwStatus; 966 dwStatus = pLastPiece->m_dwStatus;
967 } 967 }
968 return dwStatus; 968 return dwStatus;
969 } 969 }
970 return FX_TXTBREAK_None; 970 return FX_TXTBREAK_None;
971 } 971 }
972 iCount = m_pCurLine->CountChars(); 972 iCount = m_pCurLine->CountChars();
973 if (iCount < 1) { 973 if (iCount < 1) {
974 return FX_TXTBREAK_None; 974 return FX_TXTBREAK_None;
975 } 975 }
976 if (!m_bPagination) { 976 if (!m_bPagination) {
977 CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1); 977 CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1);
978 pTC->m_dwStatus = dwStatus; 978 pTC->m_dwStatus = dwStatus;
979 } 979 }
980 if (dwStatus <= FX_TXTBREAK_PieceBreak) { 980 if (dwStatus <= FX_TXTBREAK_PieceBreak) {
981 return dwStatus; 981 return dwStatus;
982 } 982 }
983 } 983 }
984 m_iReady = (m_pCurLine == m_pTxtLine1.get()) ? 1 : 2; 984 m_iReady = (m_pCurLine == m_pTxtLine1.get()) ? 1 : 2;
985 CFX_TxtLine* pNextLine = 985 CFX_TxtLine* pNextLine =
986 (m_pCurLine == m_pTxtLine1.get()) ? m_pTxtLine2.get() : m_pTxtLine1.get(); 986 (m_pCurLine == m_pTxtLine1.get()) ? m_pTxtLine2.get() : m_pTxtLine1.get();
987 FX_BOOL bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right); 987 bool bAllChars = (m_iCurAlignment > FX_TXTLINEALIGNMENT_Right);
988 CFX_TPOArray tpos(100); 988 CFX_TPOArray tpos(100);
989 CFX_Char* pTC; 989 CFX_Char* pTC;
990 if (m_bArabicShapes) { 990 if (m_bArabicShapes) {
991 EndBreak_UpdateArabicShapes(); 991 EndBreak_UpdateArabicShapes();
992 } 992 }
993 if (EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) { 993 if (EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) {
994 goto EndBreak_Ret; 994 goto EndBreak_Ret;
995 } 995 }
996 EndBreak_BidiLine(tpos, dwStatus); 996 EndBreak_BidiLine(tpos, dwStatus);
997 if (!m_bPagination && m_iCurAlignment > FX_TXTLINEALIGNMENT_Left) { 997 if (!m_bPagination && m_iCurAlignment > FX_TXTLINEALIGNMENT_Left) {
998 EndBreak_Alignment(tpos, bAllChars, dwStatus); 998 EndBreak_Alignment(tpos, bAllChars, dwStatus);
999 } 999 }
1000 EndBreak_Ret: 1000 EndBreak_Ret:
1001 m_pCurLine = pNextLine; 1001 m_pCurLine = pNextLine;
1002 pTC = GetLastChar(0, FALSE); 1002 pTC = GetLastChar(0, false);
1003 m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown; 1003 m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown;
1004 if (dwStatus == FX_TXTBREAK_ParagraphBreak) { 1004 if (dwStatus == FX_TXTBREAK_ParagraphBreak) {
1005 m_iArabicContext = m_iCurArabicContext = 1; 1005 m_iArabicContext = m_iCurArabicContext = 1;
1006 ResetArabicContext(); 1006 ResetArabicContext();
1007 } 1007 }
1008 return dwStatus; 1008 return dwStatus;
1009 } 1009 }
1010 1010
1011 int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca, 1011 int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca,
1012 int32_t& iEndPos, 1012 int32_t& iEndPos,
1013 FX_BOOL bAllChars, 1013 bool bAllChars,
1014 FX_BOOL bOnlyBrk) { 1014 bool bOnlyBrk) {
1015 int32_t iLength = ca.GetSize() - 1; 1015 int32_t iLength = ca.GetSize() - 1;
1016 if (iLength < 1) { 1016 if (iLength < 1) {
1017 return iLength; 1017 return iLength;
1018 } 1018 }
1019 int32_t iBreak = -1, iBreakPos = -1, iIndirect = -1, iIndirectPos = -1, 1019 int32_t iBreak = -1, iBreakPos = -1, iIndirect = -1, iIndirectPos = -1,
1020 iLast = -1, iLastPos = -1; 1020 iLast = -1, iLastPos = -1;
1021 if (m_bSingleLine || iEndPos <= m_iLineWidth) { 1021 if (m_bSingleLine || iEndPos <= m_iLineWidth) {
1022 if (!bAllChars) { 1022 if (!bAllChars) {
1023 return iLength; 1023 return iLength;
1024 } 1024 }
1025 iBreak = iLength; 1025 iBreak = iLength;
1026 iBreakPos = iEndPos; 1026 iBreakPos = iEndPos;
1027 } 1027 }
1028 FX_BOOL bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0; 1028 bool bSpaceBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_SpaceBreak) != 0;
1029 FX_BOOL bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0; 1029 bool bNumberBreak = (m_dwPolicies & FX_TXTBREAKPOLICY_NumberBreak) != 0;
1030 FX_LINEBREAKTYPE eType; 1030 FX_LINEBREAKTYPE eType;
1031 uint32_t nCodeProp, nCur, nNext; 1031 uint32_t nCodeProp, nCur, nNext;
1032 CFX_Char* pCur = ca.GetDataPtr(iLength--); 1032 CFX_Char* pCur = ca.GetDataPtr(iLength--);
1033 if (bAllChars) { 1033 if (bAllChars) {
1034 pCur->m_nBreakType = FX_LBT_UNKNOWN; 1034 pCur->m_nBreakType = FX_LBT_UNKNOWN;
1035 } 1035 }
1036 nCodeProp = pCur->m_dwCharProps; 1036 nCodeProp = pCur->m_dwCharProps;
1037 nNext = nCodeProp & 0x003F; 1037 nNext = nCodeProp & 0x003F;
1038 int32_t iCharWidth = pCur->m_iCharWidth; 1038 int32_t iCharWidth = pCur->m_iCharWidth;
1039 if (iCharWidth > 0) { 1039 if (iCharWidth > 0) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 } 1100 }
1101 if (iLast > -1) { 1101 if (iLast > -1) {
1102 iEndPos = iLastPos; 1102 iEndPos = iLastPos;
1103 return iLast; 1103 return iLast;
1104 } 1104 }
1105 return 0; 1105 return 0;
1106 } 1106 }
1107 1107
1108 void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine, 1108 void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
1109 CFX_TxtLine* pNextLine, 1109 CFX_TxtLine* pNextLine,
1110 FX_BOOL bAllChars) { 1110 bool bAllChars) {
1111 ASSERT(pCurLine && pNextLine); 1111 ASSERT(pCurLine && pNextLine);
1112 int32_t iCount = pCurLine->CountChars(); 1112 int32_t iCount = pCurLine->CountChars();
1113 if (iCount < 2) { 1113 if (iCount < 2) {
1114 return; 1114 return;
1115 } 1115 }
1116 int32_t iEndPos = pCurLine->m_iWidth; 1116 int32_t iEndPos = pCurLine->m_iWidth;
1117 CFX_TxtCharArray& curChars = *pCurLine->m_pLineChars.get(); 1117 CFX_TxtCharArray& curChars = *pCurLine->m_pLineChars.get();
1118 int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, FALSE); 1118 int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false);
1119 if (iCharPos < 0) { 1119 if (iCharPos < 0) {
1120 iCharPos = 0; 1120 iCharPos = 0;
1121 } 1121 }
1122 iCharPos++; 1122 iCharPos++;
1123 if (iCharPos >= iCount) { 1123 if (iCharPos >= iCount) {
1124 pNextLine->RemoveAll(TRUE); 1124 pNextLine->RemoveAll(true);
1125 CFX_Char* pTC = curChars.GetDataPtr(iCharPos - 1); 1125 CFX_Char* pTC = curChars.GetDataPtr(iCharPos - 1);
1126 pTC->m_nBreakType = FX_LBT_UNKNOWN; 1126 pTC->m_nBreakType = FX_LBT_UNKNOWN;
1127 return; 1127 return;
1128 } 1128 }
1129 CFX_TxtCharArray& nextChars = *pNextLine->m_pLineChars.get(); 1129 CFX_TxtCharArray& nextChars = *pNextLine->m_pLineChars.get();
1130 int cur_size = curChars.GetSize(); 1130 int cur_size = curChars.GetSize();
1131 nextChars.SetSize(cur_size - iCharPos); 1131 nextChars.SetSize(cur_size - iCharPos);
1132 FXSYS_memcpy(nextChars.GetData(), curChars.GetDataPtr(iCharPos), 1132 FXSYS_memcpy(nextChars.GetData(), curChars.GetDataPtr(iCharPos),
1133 (cur_size - iCharPos) * sizeof(CFX_TxtChar)); 1133 (cur_size - iCharPos) * sizeof(CFX_TxtChar));
1134 iCount -= iCharPos; 1134 iCount -= iCharPos;
(...skipping 16 matching lines...) Expand all
1151 } 1151 }
1152 if (m_bPagination) { 1152 if (m_bPagination) {
1153 continue; 1153 continue;
1154 } 1154 }
1155 pTC->m_dwStatus = 0; 1155 pTC->m_dwStatus = 0;
1156 } 1156 }
1157 pNextLine->m_iWidth = iWidth; 1157 pNextLine->m_iWidth = iWidth;
1158 } 1158 }
1159 1159
1160 int32_t CFX_TxtBreak::CountBreakChars() const { 1160 int32_t CFX_TxtBreak::CountBreakChars() const {
1161 CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); 1161 CFX_TxtLine* pTxtLine = GetTxtLine(true);
1162 return pTxtLine ? pTxtLine->CountChars() : 0; 1162 return pTxtLine ? pTxtLine->CountChars() : 0;
1163 } 1163 }
1164 1164
1165 int32_t CFX_TxtBreak::CountBreakPieces() const { 1165 int32_t CFX_TxtBreak::CountBreakPieces() const {
1166 CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); 1166 CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(true);
1167 return pTxtPieces ? pTxtPieces->GetSize() : 0; 1167 return pTxtPieces ? pTxtPieces->GetSize() : 0;
1168 } 1168 }
1169 1169
1170 const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const { 1170 const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const {
1171 CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE); 1171 CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(true);
1172 if (!pTxtPieces) { 1172 if (!pTxtPieces) {
1173 return nullptr; 1173 return nullptr;
1174 } 1174 }
1175 if (index < 0 || index >= pTxtPieces->GetSize()) { 1175 if (index < 0 || index >= pTxtPieces->GetSize()) {
1176 return nullptr; 1176 return nullptr;
1177 } 1177 }
1178 return pTxtPieces->GetPtrAt(index); 1178 return pTxtPieces->GetPtrAt(index);
1179 } 1179 }
1180 1180
1181 void CFX_TxtBreak::ClearBreakPieces() { 1181 void CFX_TxtBreak::ClearBreakPieces() {
1182 CFX_TxtLine* pTxtLine = GetTxtLine(TRUE); 1182 CFX_TxtLine* pTxtLine = GetTxtLine(true);
1183 if (pTxtLine) { 1183 if (pTxtLine) {
1184 pTxtLine->RemoveAll(TRUE); 1184 pTxtLine->RemoveAll(true);
1185 } 1185 }
1186 m_iReady = 0; 1186 m_iReady = 0;
1187 } 1187 }
1188 1188
1189 void CFX_TxtBreak::Reset() { 1189 void CFX_TxtBreak::Reset() {
1190 m_eCharType = FX_CHARTYPE_Unknown; 1190 m_eCharType = FX_CHARTYPE_Unknown;
1191 m_iArabicContext = m_iCurArabicContext = 1; 1191 m_iArabicContext = m_iCurArabicContext = 1;
1192 ResetArabicContext(); 1192 ResetArabicContext();
1193 m_pTxtLine1->RemoveAll(TRUE); 1193 m_pTxtLine1->RemoveAll(true);
1194 m_pTxtLine2->RemoveAll(TRUE); 1194 m_pTxtLine2->RemoveAll(true);
1195 } 1195 }
1196 1196
1197 struct FX_FORMCHAR { 1197 struct FX_FORMCHAR {
1198 uint16_t wch; 1198 uint16_t wch;
1199 uint16_t wForm; 1199 uint16_t wForm;
1200 int32_t iWidth; 1200 int32_t iWidth;
1201 }; 1201 };
1202 1202
1203 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, 1203 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
1204 FXTEXT_CHARPOS* pCharPos, 1204 FXTEXT_CHARPOS* pCharPos,
1205 FX_BOOL bCharCode, 1205 bool bCharCode,
1206 CFX_WideString* pWSForms, 1206 CFX_WideString* pWSForms,
1207 FX_AdjustCharDisplayPos pAdjustPos) const { 1207 FX_AdjustCharDisplayPos pAdjustPos) const {
1208 if (!pTxtRun || pTxtRun->iLength < 1) { 1208 if (!pTxtRun || pTxtRun->iLength < 1) {
1209 return 0; 1209 return 0;
1210 } 1210 }
1211 IFX_TxtAccess* pAccess = pTxtRun->pAccess; 1211 IFX_TxtAccess* pAccess = pTxtRun->pAccess;
1212 const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; 1212 const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity;
1213 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); 1213 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
1214 int32_t* pWidths = pTxtRun->pWidths; 1214 int32_t* pWidths = pTxtRun->pWidths;
1215 int32_t iLength = pTxtRun->iLength - 1; 1215 int32_t iLength = pTxtRun->iLength - 1;
1216 CFGAS_GEFont* pFont = pTxtRun->pFont; 1216 CFGAS_GEFont* pFont = pTxtRun->pFont;
1217 uint32_t dwStyles = pTxtRun->dwStyles; 1217 uint32_t dwStyles = pTxtRun->dwStyles;
1218 CFX_RectF rtText(*pTxtRun->pRect); 1218 CFX_RectF rtText(*pTxtRun->pRect);
1219 FX_BOOL bRTLPiece = 1219 bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1220 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0; 1220 bool bArabicNumber =
1221 FX_BOOL bArabicNumber =
1222 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0; 1221 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicNumber) != 0;
1223 FX_BOOL bArabicComma = 1222 bool bArabicComma =
1224 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0; 1223 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_ArabicComma) != 0;
1225 FX_FLOAT fFontSize = pTxtRun->fFontSize; 1224 FX_FLOAT fFontSize = pTxtRun->fFontSize;
1226 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); 1225 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
1227 int32_t iAscent = pFont->GetAscent(); 1226 int32_t iAscent = pFont->GetAscent();
1228 int32_t iDescent = pFont->GetDescent(); 1227 int32_t iDescent = pFont->GetDescent();
1229 int32_t iMaxHeight = iAscent - iDescent; 1228 int32_t iMaxHeight = iAscent - iDescent;
1230 FX_FLOAT fFontHeight = fFontSize; 1229 FX_FLOAT fFontHeight = fFontSize;
1231 FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight; 1230 FX_FLOAT fAscent = fFontHeight * (FX_FLOAT)iAscent / (FX_FLOAT)iMaxHeight;
1232 FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight; 1231 FX_FLOAT fDescent = fFontHeight * (FX_FLOAT)iDescent / (FX_FLOAT)iMaxHeight;
1233 FX_BOOL bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; 1232 bool bVerticalDoc = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0;
1234 FX_BOOL bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0; 1233 bool bVerticalChar = (dwStyles & FX_TXTLAYOUTSTYLE_VerticalChars) != 0;
1235 int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation; 1234 int32_t iRotation = GetLineRotation(dwStyles) + pTxtRun->iCharRotation;
1236 FX_FLOAT fX, fY, fCharWidth, fCharHeight; 1235 FX_FLOAT fX, fY, fCharWidth, fCharHeight;
1237 int32_t iHorScale = pTxtRun->iHorizontalScale; 1236 int32_t iHorScale = pTxtRun->iHorizontalScale;
1238 int32_t iVerScale = pTxtRun->iVerticalScale; 1237 int32_t iVerScale = pTxtRun->iVerticalScale;
1239 FX_BOOL bSkipSpace = pTxtRun->bSkipSpace; 1238 bool bSkipSpace = pTxtRun->bSkipSpace;
1240 FX_FORMCHAR formChars[3]; 1239 FX_FORMCHAR formChars[3];
1241 FX_FLOAT fYBase; 1240 FX_FLOAT fYBase;
1242 fX = rtText.left; 1241 fX = rtText.left;
1243 if (bVerticalDoc) { 1242 if (bVerticalDoc) {
1244 fX += (rtText.width - fFontSize) / 2.0f; 1243 fX += (rtText.width - fFontSize) / 2.0f;
1245 fYBase = bRTLPiece ? rtText.bottom() : rtText.top; 1244 fYBase = bRTLPiece ? rtText.bottom() : rtText.top;
1246 fY = fYBase; 1245 fY = fYBase;
1247 } else { 1246 } else {
1248 if (bRTLPiece) { 1247 if (bRTLPiece) {
1249 fX = rtText.right(); 1248 fX = rtText.right();
1250 } 1249 }
1251 fYBase = rtText.top + (rtText.height - fFontSize) / 2.0f; 1250 fYBase = rtText.top + (rtText.height - fFontSize) / 2.0f;
1252 fY = fYBase + fAscent; 1251 fY = fYBase + fAscent;
1253 } 1252 }
1254 int32_t iCount = 0; 1253 int32_t iCount = 0;
1255 int32_t iNext = 0; 1254 int32_t iNext = 0;
1256 FX_WCHAR wPrev = 0xFEFF; 1255 FX_WCHAR wPrev = 0xFEFF;
1257 FX_WCHAR wNext = 0xFEFF; 1256 FX_WCHAR wNext = 0xFEFF;
1258 FX_WCHAR wForm = 0xFEFF; 1257 FX_WCHAR wForm = 0xFEFF;
1259 FX_WCHAR wLast = 0xFEFF; 1258 FX_WCHAR wLast = 0xFEFF;
1260 FX_BOOL bShadda = FALSE; 1259 bool bShadda = false;
1261 FX_BOOL bLam = FALSE; 1260 bool bLam = false;
1262 for (int32_t i = 0; i <= iLength; i++) { 1261 for (int32_t i = 0; i <= iLength; i++) {
1263 int32_t iWidth; 1262 int32_t iWidth;
1264 FX_WCHAR wch; 1263 FX_WCHAR wch;
1265 if (pAccess) { 1264 if (pAccess) {
1266 wch = pAccess->GetChar(pIdentity, i); 1265 wch = pAccess->GetChar(pIdentity, i);
1267 iWidth = pAccess->GetWidth(pIdentity, i); 1266 iWidth = pAccess->GetWidth(pIdentity, i);
1268 } else { 1267 } else {
1269 wch = *pStr++; 1268 wch = *pStr++;
1270 iWidth = *pWidths++; 1269 iWidth = *pWidths++;
1271 } 1270 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 } else { 1307 } else {
1309 wNext = 0xFEFF; 1308 wNext = 0xFEFF;
1310 } 1309 }
1311 wForm = pdfium::arabic::GetFormChar(wch, wPrev, wNext); 1310 wForm = pdfium::arabic::GetFormChar(wch, wPrev, wNext);
1312 bLam = (wPrev == 0x0644 && wch == 0x0644 && wNext == 0x0647); 1311 bLam = (wPrev == 0x0644 && wch == 0x0644 && wNext == 0x0647);
1313 } else if (chartype == FX_CHARTYPE_Combination) { 1312 } else if (chartype == FX_CHARTYPE_Combination) {
1314 wForm = wch; 1313 wForm = wch;
1315 if (wch >= 0x064C && wch <= 0x0651) { 1314 if (wch >= 0x064C && wch <= 0x0651) {
1316 if (bShadda) { 1315 if (bShadda) {
1317 wForm = 0xFEFF; 1316 wForm = 0xFEFF;
1318 bShadda = FALSE; 1317 bShadda = false;
1319 } else { 1318 } else {
1320 wNext = 0xFEFF; 1319 wNext = 0xFEFF;
1321 if (pAccess) { 1320 if (pAccess) {
1322 iNext = i + 1; 1321 iNext = i + 1;
1323 if (iNext <= iLength) { 1322 if (iNext <= iLength) {
1324 wNext = pAccess->GetChar(pIdentity, iNext); 1323 wNext = pAccess->GetChar(pIdentity, iNext);
1325 } 1324 }
1326 } else { 1325 } else {
1327 if (i < iLength) { 1326 if (i < iLength) {
1328 wNext = *pStr; 1327 wNext = *pStr;
1329 } 1328 }
1330 } 1329 }
1331 if (wch == 0x0651) { 1330 if (wch == 0x0651) {
1332 if (wNext >= 0x064C && wNext <= 0x0650) { 1331 if (wNext >= 0x064C && wNext <= 0x0650) {
1333 wForm = FX_GetArabicFromShaddaTable(wNext); 1332 wForm = FX_GetArabicFromShaddaTable(wNext);
1334 bShadda = TRUE; 1333 bShadda = true;
1335 } 1334 }
1336 } else { 1335 } else {
1337 if (wNext == 0x0651) { 1336 if (wNext == 0x0651) {
1338 wForm = FX_GetArabicFromShaddaTable(wch); 1337 wForm = FX_GetArabicFromShaddaTable(wch);
1339 bShadda = TRUE; 1338 bShadda = true;
1340 } 1339 }
1341 } 1340 }
1342 } 1341 }
1343 } else { 1342 } else {
1344 bShadda = FALSE; 1343 bShadda = false;
1345 } 1344 }
1346 } else if (chartype == FX_CHARTYPE_Numeric) { 1345 } else if (chartype == FX_CHARTYPE_Numeric) {
1347 wForm = wch; 1346 wForm = wch;
1348 if (bArabicNumber) { 1347 if (bArabicNumber) {
1349 wForm += 0x0630; 1348 wForm += 0x0630;
1350 } 1349 }
1351 } else if (wch == L'.') { 1350 } else if (wch == L'.') {
1352 wForm = wch; 1351 wForm = wch;
1353 if (bArabicNumber) { 1352 if (bArabicNumber) {
1354 wNext = 0xFEFF; 1353 wNext = 0xFEFF;
(...skipping 15 matching lines...) Expand all
1370 wForm = wch; 1369 wForm = wch;
1371 if (bArabicComma) { 1370 if (bArabicComma) {
1372 wForm = 0x060C; 1371 wForm = 0x060C;
1373 } 1372 }
1374 } else if (bRTLPiece || bVerticalChar) { 1373 } else if (bRTLPiece || bVerticalChar) {
1375 wForm = FX_GetMirrorChar(wch, dwProps, bRTLPiece, bVerticalChar); 1374 wForm = FX_GetMirrorChar(wch, dwProps, bRTLPiece, bVerticalChar);
1376 } else { 1375 } else {
1377 wForm = wch; 1376 wForm = wch;
1378 } 1377 }
1379 if (chartype != FX_CHARTYPE_Combination) { 1378 if (chartype != FX_CHARTYPE_Combination) {
1380 bShadda = FALSE; 1379 bShadda = false;
1381 } 1380 }
1382 if (chartype < FX_CHARTYPE_ArabicAlef) { 1381 if (chartype < FX_CHARTYPE_ArabicAlef) {
1383 bLam = FALSE; 1382 bLam = false;
1384 } 1383 }
1385 dwProps = FX_GetUnicodeProperties(wForm); 1384 dwProps = FX_GetUnicodeProperties(wForm);
1386 int32_t iCharRotation = iRotation; 1385 int32_t iCharRotation = iRotation;
1387 if (bVerticalChar && (dwProps & 0x8000) != 0) { 1386 if (bVerticalChar && (dwProps & 0x8000) != 0) {
1388 iCharRotation++; 1387 iCharRotation++;
1389 } 1388 }
1390 iCharRotation %= 4; 1389 iCharRotation %= 4;
1391 FX_BOOL bEmptyChar = 1390 bool bEmptyChar =
1392 (chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control); 1391 (chartype >= FX_CHARTYPE_Tab && chartype <= FX_CHARTYPE_Control);
1393 if (wForm == 0xFEFF) { 1392 if (wForm == 0xFEFF) {
1394 bEmptyChar = TRUE; 1393 bEmptyChar = true;
1395 } 1394 }
1396 int32_t iForms = bLam ? 3 : 1; 1395 int32_t iForms = bLam ? 3 : 1;
1397 iCount += (bEmptyChar && bSkipSpace) ? 0 : iForms; 1396 iCount += (bEmptyChar && bSkipSpace) ? 0 : iForms;
1398 if (!pCharPos) { 1397 if (!pCharPos) {
1399 if (iWidth > 0) { 1398 if (iWidth > 0) {
1400 wPrev = wch; 1399 wPrev = wch;
1401 } 1400 }
1402 wLast = wch; 1401 wLast = wch;
1403 continue; 1402 continue;
1404 } 1403 }
1405 int32_t iCharWidth = iWidth; 1404 int32_t iCharWidth = iWidth;
1406 if (iCharWidth < 0) { 1405 if (iCharWidth < 0) {
1407 iCharWidth = -iCharWidth; 1406 iCharWidth = -iCharWidth;
1408 } 1407 }
1409 iCharWidth /= iFontSize; 1408 iCharWidth /= iFontSize;
1410 formChars[0].wch = wch; 1409 formChars[0].wch = wch;
1411 formChars[0].wForm = wForm; 1410 formChars[0].wForm = wForm;
1412 formChars[0].iWidth = iCharWidth; 1411 formChars[0].iWidth = iCharWidth;
1413 if (bLam) { 1412 if (bLam) {
1414 formChars[1].wForm = 0x0651; 1413 formChars[1].wForm = 0x0651;
1415 iCharWidth = 0; 1414 iCharWidth = 0;
1416 pFont->GetCharWidth(0x0651, iCharWidth, FALSE); 1415 pFont->GetCharWidth(0x0651, iCharWidth, false);
1417 formChars[1].iWidth = iCharWidth; 1416 formChars[1].iWidth = iCharWidth;
1418 formChars[2].wForm = 0x0670; 1417 formChars[2].wForm = 0x0670;
1419 iCharWidth = 0; 1418 iCharWidth = 0;
1420 pFont->GetCharWidth(0x0670, iCharWidth, FALSE); 1419 pFont->GetCharWidth(0x0670, iCharWidth, false);
1421 formChars[2].iWidth = iCharWidth; 1420 formChars[2].iWidth = iCharWidth;
1422 } 1421 }
1423 for (int32_t j = 0; j < iForms; j++) { 1422 for (int32_t j = 0; j < iForms; j++) {
1424 wForm = (FX_WCHAR)formChars[j].wForm; 1423 wForm = (FX_WCHAR)formChars[j].wForm;
1425 iCharWidth = formChars[j].iWidth; 1424 iCharWidth = formChars[j].iWidth;
1426 if (j > 0) { 1425 if (j > 0) {
1427 chartype = FX_CHARTYPE_Combination; 1426 chartype = FX_CHARTYPE_Combination;
1428 wch = wForm; 1427 wch = wForm;
1429 wLast = (FX_WCHAR)formChars[j - 1].wForm; 1428 wLast = (FX_WCHAR)formChars[j - 1].wForm;
1430 } 1429 }
1431 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { 1430 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
1432 pCharPos->m_GlyphIndex = 1431 pCharPos->m_GlyphIndex =
1433 bCharCode ? wch : pFont->GetGlyphIndex(wForm, FALSE); 1432 bCharCode ? wch : pFont->GetGlyphIndex(wForm, false);
1434 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1433 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
1435 pCharPos->m_ExtGID = pCharPos->m_GlyphIndex; 1434 pCharPos->m_ExtGID = pCharPos->m_GlyphIndex;
1436 #endif 1435 #endif
1437 pCharPos->m_FontCharWidth = iCharWidth; 1436 pCharPos->m_FontCharWidth = iCharWidth;
1438 if (pWSForms) { 1437 if (pWSForms) {
1439 *pWSForms += wForm; 1438 *pWSForms += wForm;
1440 } 1439 }
1441 } 1440 }
1442 int32_t iCharHeight; 1441 int32_t iCharHeight;
1443 if (bVerticalDoc) { 1442 if (bVerticalDoc) {
1444 iCharHeight = iCharWidth; 1443 iCharHeight = iCharWidth;
1445 iCharWidth = 1000; 1444 iCharWidth = 1000;
1446 } else { 1445 } else {
1447 iCharHeight = 1000; 1446 iCharHeight = 1000;
1448 } 1447 }
1449 fCharWidth = fFontSize * iCharWidth / 1000.0f; 1448 fCharWidth = fFontSize * iCharWidth / 1000.0f;
1450 fCharHeight = fFontSize * iCharHeight / 1000.0f; 1449 fCharHeight = fFontSize * iCharHeight / 1000.0f;
1451 if (bRTLPiece && chartype != FX_CHARTYPE_Combination) { 1450 if (bRTLPiece && chartype != FX_CHARTYPE_Combination) {
1452 if (bVerticalDoc) { 1451 if (bVerticalDoc) {
1453 fY -= fCharHeight; 1452 fY -= fCharHeight;
1454 } else { 1453 } else {
1455 fX -= fCharWidth; 1454 fX -= fCharWidth;
1456 } 1455 }
1457 } 1456 }
1458 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { 1457 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
1459 pCharPos->m_OriginX = fX; 1458 pCharPos->m_OriginX = fX;
1460 pCharPos->m_OriginY = fY; 1459 pCharPos->m_OriginY = fY;
1461 if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) { 1460 if ((dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0) {
1462 int32_t iFormWidth = iCharWidth; 1461 int32_t iFormWidth = iCharWidth;
1463 pFont->GetCharWidth(wForm, iFormWidth, FALSE); 1462 pFont->GetCharWidth(wForm, iFormWidth, false);
1464 FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f; 1463 FX_FLOAT fOffset = fFontSize * (iCharWidth - iFormWidth) / 2000.0f;
1465 if (bVerticalDoc) { 1464 if (bVerticalDoc) {
1466 pCharPos->m_OriginY += fOffset; 1465 pCharPos->m_OriginY += fOffset;
1467 } else { 1466 } else {
1468 pCharPos->m_OriginX += fOffset; 1467 pCharPos->m_OriginX += fOffset;
1469 } 1468 }
1470 } 1469 }
1471 if (chartype == FX_CHARTYPE_Combination) { 1470 if (chartype == FX_CHARTYPE_Combination) {
1472 CFX_Rect rtBBox; 1471 CFX_Rect rtBBox;
1473 rtBBox.Reset(); 1472 rtBBox.Reset();
1474 if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { 1473 if (pFont->GetCharBBox(wForm, rtBBox, false)) {
1475 pCharPos->m_OriginY = 1474 pCharPos->m_OriginY =
1476 fYBase + fFontSize - 1475 fYBase + fFontSize -
1477 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight; 1476 fFontSize * (FX_FLOAT)rtBBox.height / (FX_FLOAT)iMaxHeight;
1478 } 1477 }
1479 if (wForm == wch && wLast != 0xFEFF) { 1478 if (wForm == wch && wLast != 0xFEFF) {
1480 uint32_t dwLastProps = FX_GetUnicodeProperties(wLast); 1479 uint32_t dwLastProps = FX_GetUnicodeProperties(wLast);
1481 if ((dwLastProps & FX_CHARTYPEBITSMASK) == 1480 if ((dwLastProps & FX_CHARTYPEBITSMASK) ==
1482 FX_CHARTYPE_Combination) { 1481 FX_CHARTYPE_Combination) {
1483 CFX_Rect rtBox; 1482 CFX_Rect rtBox;
1484 rtBox.Reset(); 1483 rtBox.Reset();
1485 if (pFont->GetCharBBox(wLast, rtBox, FALSE)) { 1484 if (pFont->GetCharBBox(wLast, rtBox, false)) {
1486 pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight; 1485 pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight;
1487 } 1486 }
1488 } 1487 }
1489 } 1488 }
1490 } 1489 }
1491 CFX_PointF ptOffset; 1490 CFX_PointF ptOffset;
1492 FX_BOOL bAdjusted = FALSE; 1491 bool bAdjusted = false;
1493 if (pAdjustPos) { 1492 if (pAdjustPos) {
1494 bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize, 1493 bAdjusted = pAdjustPos(wForm, bCharCode, pFont, fFontSize,
1495 bVerticalChar, ptOffset); 1494 bVerticalChar, ptOffset);
1496 } 1495 }
1497 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) { 1496 if (!bAdjusted && bVerticalChar && (dwProps & 0x00010000) != 0) {
1498 CFX_Rect rtBBox; 1497 CFX_Rect rtBBox;
1499 rtBBox.Reset(); 1498 rtBBox.Reset();
1500 if (pFont->GetCharBBox(wForm, rtBBox, FALSE)) { 1499 if (pFont->GetCharBBox(wForm, rtBBox, false)) {
1501 ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight; 1500 ptOffset.x = fFontSize * (850 - rtBBox.right()) / iMaxHeight;
1502 ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight; 1501 ptOffset.y = fFontSize * (iAscent - rtBBox.top - 150) / iMaxHeight;
1503 } 1502 }
1504 } 1503 }
1505 pCharPos->m_OriginX += ptOffset.x; 1504 pCharPos->m_OriginX += ptOffset.x;
1506 pCharPos->m_OriginY -= ptOffset.y; 1505 pCharPos->m_OriginY -= ptOffset.y;
1507 } 1506 }
1508 if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) { 1507 if (!bRTLPiece && chartype != FX_CHARTYPE_Combination) {
1509 if (bVerticalDoc) { 1508 if (bVerticalDoc) {
1510 fY += fCharHeight; 1509 fY += fCharHeight;
1511 } else { 1510 } else {
1512 fX += fCharWidth; 1511 fX += fCharWidth;
1513 } 1512 }
1514 } 1513 }
1515 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { 1514 if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
1516 pCharPos->m_bGlyphAdjust = TRUE; 1515 pCharPos->m_bGlyphAdjust = true;
1517 if (bVerticalDoc) { 1516 if (bVerticalDoc) {
1518 if (iCharRotation == 0) { 1517 if (iCharRotation == 0) {
1519 pCharPos->m_AdjustMatrix[0] = -1; 1518 pCharPos->m_AdjustMatrix[0] = -1;
1520 pCharPos->m_AdjustMatrix[1] = 0; 1519 pCharPos->m_AdjustMatrix[1] = 0;
1521 pCharPos->m_AdjustMatrix[2] = 0; 1520 pCharPos->m_AdjustMatrix[2] = 0;
1522 pCharPos->m_AdjustMatrix[3] = 1; 1521 pCharPos->m_AdjustMatrix[3] = 1;
1523 pCharPos->m_OriginY += fAscent; 1522 pCharPos->m_OriginY += fAscent;
1524 } else if (iCharRotation == 1) { 1523 } else if (iCharRotation == 1) {
1525 pCharPos->m_AdjustMatrix[0] = 0; 1524 pCharPos->m_AdjustMatrix[0] = 0;
1526 pCharPos->m_AdjustMatrix[1] = -1; 1525 pCharPos->m_AdjustMatrix[1] = -1;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 if (iWidth > 0) { 1584 if (iWidth > 0) {
1586 wPrev = (FX_WCHAR)formChars[0].wch; 1585 wPrev = (FX_WCHAR)formChars[0].wch;
1587 } 1586 }
1588 wLast = wch; 1587 wLast = wch;
1589 } 1588 }
1590 return iCount; 1589 return iCount;
1591 } 1590 }
1592 1591
1593 int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, 1592 int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
1594 CFX_RectFArray& rtArray, 1593 CFX_RectFArray& rtArray,
1595 FX_BOOL bCharBBox) const { 1594 bool bCharBBox) const {
1596 if (!pTxtRun || pTxtRun->iLength < 1) { 1595 if (!pTxtRun || pTxtRun->iLength < 1) {
1597 return 0; 1596 return 0;
1598 } 1597 }
1599 IFX_TxtAccess* pAccess = pTxtRun->pAccess; 1598 IFX_TxtAccess* pAccess = pTxtRun->pAccess;
1600 const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; 1599 const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity;
1601 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); 1600 const FX_WCHAR* pStr = pTxtRun->wsStr.c_str();
1602 int32_t* pWidths = pTxtRun->pWidths; 1601 int32_t* pWidths = pTxtRun->pWidths;
1603 int32_t iLength = pTxtRun->iLength; 1602 int32_t iLength = pTxtRun->iLength;
1604 CFX_RectF rect(*pTxtRun->pRect); 1603 CFX_RectF rect(*pTxtRun->pRect);
1605 FX_BOOL bRTLPiece = 1604 bool bRTLPiece = (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1606 (pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel) != 0;
1607 FX_FLOAT fFontSize = pTxtRun->fFontSize; 1605 FX_FLOAT fFontSize = pTxtRun->fFontSize;
1608 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); 1606 int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
1609 FX_FLOAT fScale = fFontSize / 1000.0f; 1607 FX_FLOAT fScale = fFontSize / 1000.0f;
1610 CFGAS_GEFont* pFont = pTxtRun->pFont; 1608 CFGAS_GEFont* pFont = pTxtRun->pFont;
1611 if (!pFont) { 1609 if (!pFont) {
1612 bCharBBox = FALSE; 1610 bCharBBox = false;
1613 } 1611 }
1614 CFX_Rect bbox; 1612 CFX_Rect bbox;
1615 bbox.Set(0, 0, 0, 0); 1613 bbox.Set(0, 0, 0, 0);
1616 if (bCharBBox) { 1614 if (bCharBBox) {
1617 bCharBBox = pFont->GetBBox(bbox); 1615 bCharBBox = pFont->GetBBox(bbox);
1618 } 1616 }
1619 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale); 1617 FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
1620 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale); 1618 FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
1621 rtArray.RemoveAll(); 1619 rtArray.RemoveAll();
1622 rtArray.SetSize(iLength); 1620 rtArray.SetSize(iLength);
1623 FX_BOOL bVertical = 1621 bool bVertical = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0;
1624 (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0; 1622 bool bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0;
1625 FX_BOOL bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0; 1623 bool bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0;
1626 FX_BOOL bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0;
1627 FX_WCHAR wch, wLineBreakChar = pTxtRun->wLineBreakChar; 1624 FX_WCHAR wch, wLineBreakChar = pTxtRun->wLineBreakChar;
1628 int32_t iCharSize; 1625 int32_t iCharSize;
1629 FX_FLOAT fCharSize, fStart; 1626 FX_FLOAT fCharSize, fStart;
1630 if (bVertical) { 1627 if (bVertical) {
1631 fStart = bRTLPiece ? rect.bottom() : rect.top; 1628 fStart = bRTLPiece ? rect.bottom() : rect.top;
1632 } else { 1629 } else {
1633 fStart = bRTLPiece ? rect.right() : rect.left; 1630 fStart = bRTLPiece ? rect.right() : rect.left;
1634 } 1631 }
1635 for (int32_t i = 0; i < iLength; i++) { 1632 for (int32_t i = 0; i < iLength; i++) {
1636 if (pAccess) { 1633 if (pAccess) {
1637 wch = pAccess->GetChar(pIdentity, i); 1634 wch = pAccess->GetChar(pIdentity, i);
1638 iCharSize = pAccess->GetWidth(pIdentity, i); 1635 iCharSize = pAccess->GetWidth(pIdentity, i);
1639 } else { 1636 } else {
1640 wch = *pStr++; 1637 wch = *pStr++;
1641 iCharSize = *pWidths++; 1638 iCharSize = *pWidths++;
1642 } 1639 }
1643 fCharSize = (FX_FLOAT)iCharSize / 20000.0f; 1640 fCharSize = (FX_FLOAT)iCharSize / 20000.0f;
1644 FX_BOOL bRet = (!bSingleLine && FX_IsCtrlCode(wch)); 1641 bool bRet = (!bSingleLine && FX_IsCtrlCode(wch));
1645 if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 || 1642 if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 ||
1646 (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) { 1643 (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) {
1647 bRet = FALSE; 1644 bRet = false;
1648 } 1645 }
1649 if (bRet) { 1646 if (bRet) {
1650 iCharSize = iFontSize * 500; 1647 iCharSize = iFontSize * 500;
1651 fCharSize = fFontSize / 2.0f; 1648 fCharSize = fFontSize / 2.0f;
1652 } 1649 }
1653 if (bVertical) { 1650 if (bVertical) {
1654 rect.top = fStart; 1651 rect.top = fStart;
1655 if (bRTLPiece) { 1652 if (bRTLPiece) {
1656 rect.top -= fCharSize; 1653 rect.top -= fCharSize;
1657 fStart -= fCharSize; 1654 fStart -= fCharSize;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 iLength(0), 1706 iLength(0),
1710 pFont(nullptr), 1707 pFont(nullptr),
1711 fFontSize(12), 1708 fFontSize(12),
1712 dwStyles(0), 1709 dwStyles(0),
1713 iHorizontalScale(100), 1710 iHorizontalScale(100),
1714 iVerticalScale(100), 1711 iVerticalScale(100),
1715 iCharRotation(0), 1712 iCharRotation(0),
1716 dwCharStyles(0), 1713 dwCharStyles(0),
1717 pRect(nullptr), 1714 pRect(nullptr),
1718 wLineBreakChar(L'\n'), 1715 wLineBreakChar(L'\n'),
1719 bSkipSpace(TRUE) {} 1716 bSkipSpace(true) {}
1720 1717
1721 FX_TXTRUN::~FX_TXTRUN() {} 1718 FX_TXTRUN::~FX_TXTRUN() {}
1722 1719
1723 FX_TXTRUN::FX_TXTRUN(const FX_TXTRUN& other) = default; 1720 FX_TXTRUN::FX_TXTRUN(const FX_TXTRUN& other) = default;
1724 1721
1725 CFX_TxtPiece::CFX_TxtPiece() 1722 CFX_TxtPiece::CFX_TxtPiece()
1726 : m_dwStatus(FX_TXTBREAK_PieceBreak), 1723 : m_dwStatus(FX_TXTBREAK_PieceBreak),
1727 m_iStartPos(0), 1724 m_iStartPos(0),
1728 m_iWidth(-1), 1725 m_iWidth(-1),
1729 m_iStartChar(0), 1726 m_iStartChar(0),
1730 m_iChars(0), 1727 m_iChars(0),
1731 m_iBidiLevel(0), 1728 m_iBidiLevel(0),
1732 m_iBidiPos(0), 1729 m_iBidiPos(0),
1733 m_iHorizontalScale(100), 1730 m_iHorizontalScale(100),
1734 m_iVerticalScale(100), 1731 m_iVerticalScale(100),
1735 m_dwCharStyles(0), 1732 m_dwCharStyles(0),
1736 m_pChars(nullptr), 1733 m_pChars(nullptr),
1737 m_pUserData(nullptr) {} 1734 m_pUserData(nullptr) {}
1738 1735
1739 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) 1736 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize)
1740 : m_pLineChars(new CFX_TxtCharArray), 1737 : m_pLineChars(new CFX_TxtCharArray),
1741 m_pLinePieces(new CFX_TxtPieceArray(16)), 1738 m_pLinePieces(new CFX_TxtPieceArray(16)),
1742 m_iStart(0), 1739 m_iStart(0),
1743 m_iWidth(0), 1740 m_iWidth(0),
1744 m_iArabicChars(0) {} 1741 m_iArabicChars(0) {}
1745 1742
1746 CFX_TxtLine::~CFX_TxtLine() { 1743 CFX_TxtLine::~CFX_TxtLine() {
1747 RemoveAll(); 1744 RemoveAll();
1748 } 1745 }
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_textbreak.h ('k') | xfa/fgas/layout/fgas_unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698