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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, | 259 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, |
260 {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 260 {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, |
261 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 261 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, |
262 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 262 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, |
263 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, | 263 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN}, |
264 {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 264 {FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, |
265 FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, | 265 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, | 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 | |
270 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, | |
271 FX_LINEBREAKTYPE* pBrkType, | |
272 int32_t iLength) { | |
273 if (iLength < 2) { | |
274 return; | |
275 } | |
276 uint32_t dwCur, dwNext; | |
277 FX_WCHAR wch; | |
278 wch = *pwsText++; | |
279 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | |
280 iLength--; | |
281 for (int32_t i = 0; i < iLength; i++) { | |
282 wch = *pwsText++; | |
283 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | |
284 if (dwNext == FX_CBP_SP) { | |
285 pBrkType[i] = FX_LBT_PROHIBITED_BRK; | |
286 } else { | |
287 pBrkType[i] = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | |
288 (dwCur << 5) + dwNext); | |
289 } | |
290 dwCur = dwNext; | |
291 } | |
292 pBrkType[iLength] = FX_LBT_INDIRECT_BRK; | |
293 } | |
294 void FX_GetLineBreakPositions(const FX_WCHAR* pwsText, | |
295 int32_t iLength, | |
296 CFX_Int32MassArray& bp) { | |
297 if (iLength < 2) { | |
298 return; | |
299 } | |
300 FX_LINEBREAKTYPE eType; | |
301 uint32_t dwCur, dwNext; | |
302 FX_WCHAR wch; | |
303 wch = *pwsText++; | |
304 dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | |
305 iLength--; | |
306 for (int32_t i = 0; i < iLength; i++) { | |
307 wch = *pwsText++; | |
308 dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F; | |
309 if (dwNext == FX_CBP_SP) { | |
310 eType = FX_LBT_PROHIBITED_BRK; | |
311 } else { | |
312 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | |
313 (dwCur << 5) + dwNext); | |
314 } | |
315 if (eType == FX_LBT_DIRECT_BRK) { | |
316 bp.Add(i); | |
317 } | |
318 dwCur = dwNext; | |
319 } | |
320 } | |
OLD | NEW |