| 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_textbreak.h" | 7 #include "xfa/fgas/layout/fgas_textbreak.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 iEndPos -= iCharWidth; | 1007 iEndPos -= iCharWidth; |
| 1008 } | 1008 } |
| 1009 while (iLength >= 0) { | 1009 while (iLength >= 0) { |
| 1010 pCur = ca.GetDataPtr(iLength); | 1010 pCur = ca.GetDataPtr(iLength); |
| 1011 nCodeProp = pCur->m_dwCharProps; | 1011 nCodeProp = pCur->m_dwCharProps; |
| 1012 nCur = nCodeProp & 0x003F; | 1012 nCur = nCodeProp & 0x003F; |
| 1013 if (nCur == FX_CBP_SP) { | 1013 if (nCur == FX_CBP_SP) { |
| 1014 if (nNext == FX_CBP_SP) { | 1014 if (nNext == FX_CBP_SP) { |
| 1015 eType = bSpaceBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK; | 1015 eType = bSpaceBreak ? FX_LBT_DIRECT_BRK : FX_LBT_PROHIBITED_BRK; |
| 1016 } else { | 1016 } else { |
| 1017 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | 1017 eType = gs_FX_LineBreak_PairTable[nCur][nNext]; |
| 1018 (nCur << 5) + nNext); | |
| 1019 } | 1018 } |
| 1020 } else if (bNumberBreak && nCur == FX_CBP_NU && nNext == FX_CBP_NU) { | 1019 } else if (bNumberBreak && nCur == FX_CBP_NU && nNext == FX_CBP_NU) { |
| 1021 eType = FX_LBT_DIRECT_BRK; | 1020 eType = FX_LBT_DIRECT_BRK; |
| 1022 } else { | 1021 } else { |
| 1023 if (nNext == FX_CBP_SP) { | 1022 if (nNext == FX_CBP_SP) { |
| 1024 eType = FX_LBT_PROHIBITED_BRK; | 1023 eType = FX_LBT_PROHIBITED_BRK; |
| 1025 } else { | 1024 } else { |
| 1026 eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable + | 1025 eType = gs_FX_LineBreak_PairTable[nCur][nNext]; |
| 1027 (nCur << 5) + nNext); | |
| 1028 } | 1026 } |
| 1029 } | 1027 } |
| 1030 if (bAllChars) { | 1028 if (bAllChars) { |
| 1031 pCur->m_nBreakType = (uint8_t)eType; | 1029 pCur->m_nBreakType = (uint8_t)eType; |
| 1032 } | 1030 } |
| 1033 if (!bOnlyBrk) { | 1031 if (!bOnlyBrk) { |
| 1034 if (m_bSingleLine || iEndPos <= m_iLineWidth || | 1032 if (m_bSingleLine || iEndPos <= m_iLineWidth || |
| 1035 (nCur == FX_CBP_SP && !bSpaceBreak)) { | 1033 (nCur == FX_CBP_SP && !bSpaceBreak)) { |
| 1036 if (eType == FX_LBT_DIRECT_BRK && iBreak < 0) { | 1034 if (eType == FX_LBT_DIRECT_BRK && iBreak < 0) { |
| 1037 iBreak = iLength; | 1035 iBreak = iLength; |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 rtBBoxF.height = fHeight; | 1655 rtBBoxF.height = fHeight; |
| 1658 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f); | 1656 rtBBoxF.top = std::max(rtBBoxF.top, 0.0f); |
| 1659 } | 1657 } |
| 1660 rtArray.SetAt(i, rtBBoxF); | 1658 rtArray.SetAt(i, rtBBoxF); |
| 1661 continue; | 1659 continue; |
| 1662 } | 1660 } |
| 1663 rtArray.SetAt(i, rect); | 1661 rtArray.SetAt(i, rect); |
| 1664 } | 1662 } |
| 1665 return iLength; | 1663 return iLength; |
| 1666 } | 1664 } |
| OLD | NEW |