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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FX_DWORD CFX_TxtBreak::AppendChar(FX_WCHAR wch) { |
735 FX_DWORD dwProps = kTextLayoutCodeProperties[(FX_WORD)wch]; | 735 FX_DWORD dwProps = kTextLayoutCodeProperties[(uint16_t)wch]; |
736 FX_DWORD dwType = (dwProps & FX_CHARTYPEBITSMASK); | 736 FX_DWORD 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 = (FX_WORD)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; |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 } | 1317 } |
1318 void CFX_TxtBreak::Reset() { | 1318 void CFX_TxtBreak::Reset() { |
1319 m_dwCharType = 0; | 1319 m_dwCharType = 0; |
1320 m_iArabicContext = m_iCurArabicContext = 1; | 1320 m_iArabicContext = m_iCurArabicContext = 1; |
1321 ResetArabicContext(); | 1321 ResetArabicContext(); |
1322 m_pTxtLine1->RemoveAll(TRUE); | 1322 m_pTxtLine1->RemoveAll(TRUE); |
1323 m_pTxtLine2->RemoveAll(TRUE); | 1323 m_pTxtLine2->RemoveAll(TRUE); |
1324 } | 1324 } |
1325 | 1325 |
1326 struct FX_FORMCHAR { | 1326 struct FX_FORMCHAR { |
1327 FX_WORD wch; | 1327 uint16_t wch; |
1328 FX_WORD wForm; | 1328 uint16_t wForm; |
1329 int32_t iWidth; | 1329 int32_t iWidth; |
1330 }; | 1330 }; |
1331 | 1331 |
1332 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, | 1332 int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, |
1333 FXTEXT_CHARPOS* pCharPos, | 1333 FXTEXT_CHARPOS* pCharPos, |
1334 FX_BOOL bCharCode, | 1334 FX_BOOL bCharCode, |
1335 CFX_WideString* pWSForms, | 1335 CFX_WideString* pWSForms, |
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; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |