| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fgas/layout/fgas_linebreak.h" | 7 #include "xfa/fgas/layout/fgas_linebreak.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ucd.h" | 9 #include "core/fxcrt/include/fx_ucd.h" |
| 10 | 10 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 266 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, |
| 267 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, | 267 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, | 270 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, |
| 271 FX_LINEBREAKTYPE* pBrkType, | 271 FX_LINEBREAKTYPE* pBrkType, |
| 272 int32_t iLength) { | 272 int32_t iLength) { |
| 273 if (iLength < 2) { | 273 if (iLength < 2) { |
| 274 return; | 274 return; |
| 275 } | 275 } |
| 276 FX_DWORD dwCur, dwNext; | 276 uint32_t dwCur, dwNext; |
| 277 FX_WCHAR wch; | 277 FX_WCHAR wch; |
| 278 wch = *pwsText++; | 278 wch = *pwsText++; |
| 279 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | 279 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; |
| 280 iLength--; | 280 iLength--; |
| 281 for (int32_t i = 0; i < iLength; i++) { | 281 for (int32_t i = 0; i < iLength; i++) { |
| 282 wch = *pwsText++; | 282 wch = *pwsText++; |
| 283 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | 283 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; |
| 284 if (dwNext == FX_CBP_SP) { | 284 if (dwNext == FX_CBP_SP) { |
| 285 pBrkType[i] = FX_LBT_PROHIBITED_BRK; | 285 pBrkType[i] = FX_LBT_PROHIBITED_BRK; |
| 286 } else { | 286 } else { |
| 287 pBrkType[i] = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | 287 pBrkType[i] = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + |
| 288 (dwCur << 5) + dwNext); | 288 (dwCur << 5) + dwNext); |
| 289 } | 289 } |
| 290 dwCur = dwNext; | 290 dwCur = dwNext; |
| 291 } | 291 } |
| 292 pBrkType[iLength] = FX_LBT_INDIRECT_BRK; | 292 pBrkType[iLength] = FX_LBT_INDIRECT_BRK; |
| 293 } | 293 } |
| 294 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, | 294 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, |
| 295 int32_t iLength, | 295 int32_t iLength, |
| 296 CFX_Int32MassArray& bp) { | 296 CFX_Int32MassArray& bp) { |
| 297 if (iLength < 2) { | 297 if (iLength < 2) { |
| 298 return; | 298 return; |
| 299 } | 299 } |
| 300 FX_LINEBREAKTYPE eType; | 300 FX_LINEBREAKTYPE eType; |
| 301 FX_DWORD dwCur, dwNext; | 301 uint32_t dwCur, dwNext; |
| 302 FX_WCHAR wch; | 302 FX_WCHAR wch; |
| 303 wch = *pwsText++; | 303 wch = *pwsText++; |
| 304 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | 304 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; |
| 305 iLength--; | 305 iLength--; |
| 306 for (int32_t i = 0; i < iLength; i++) { | 306 for (int32_t i = 0; i < iLength; i++) { |
| 307 wch = *pwsText++; | 307 wch = *pwsText++; |
| 308 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | 308 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; |
| 309 if (dwNext == FX_CBP_SP) { | 309 if (dwNext == FX_CBP_SP) { |
| 310 eType = FX_LBT_PROHIBITED_BRK; | 310 eType = FX_LBT_PROHIBITED_BRK; |
| 311 } else { | 311 } else { |
| 312 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | 312 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + |
| 313 (dwCur << 5) + dwNext); | 313 (dwCur << 5) + dwNext); |
| 314 } | 314 } |
| 315 if (eType == FX_LBT_DIRECT_BRK) { | 315 if (eType == FX_LBT_DIRECT_BRK) { |
| 316 bp.Add(i); | 316 bp.Add(i); |
| 317 } | 317 } |
| 318 dwCur = dwNext; | 318 dwCur = dwNext; |
| 319 } | 319 } |
| 320 } | 320 } |
| OLD | NEW |