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 |
11 #include "core/fxcrt/fx_arabic.h" | 11 #include "core/fxcrt/fx_arabic.h" |
12 #include "core/fxcrt/fx_arb.h" | 12 #include "core/fxcrt/fx_arb.h" |
13 #include "core/fxcrt/fx_memory.h" | 13 #include "core/fxcrt/fx_memory.h" |
| 14 #include "third_party/base/ptr_util.h" |
14 #include "xfa/fgas/font/cfgas_gefont.h" | 15 #include "xfa/fgas/font/cfgas_gefont.h" |
15 #include "xfa/fgas/layout/fgas_linebreak.h" | 16 #include "xfa/fgas/layout/fgas_linebreak.h" |
16 #include "xfa/fgas/layout/fgas_unicode.h" | 17 #include "xfa/fgas/layout/fgas_unicode.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 typedef uint32_t (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)( | 21 typedef uint32_t (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)( |
21 CFX_TxtChar* pCurChar, | 22 CFX_TxtChar* pCurChar, |
22 int32_t iRotation); | 23 int32_t iRotation); |
23 const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { | 24 const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 m_bArabicNumber(false), | 64 m_bArabicNumber(false), |
64 m_bArabicComma(false), | 65 m_bArabicComma(false), |
65 m_pCurLine(nullptr), | 66 m_pCurLine(nullptr), |
66 m_iReady(0), | 67 m_iReady(0), |
67 m_iTolerance(0), | 68 m_iTolerance(0), |
68 m_iHorScale(100), | 69 m_iHorScale(100), |
69 m_iVerScale(100), | 70 m_iVerScale(100), |
70 m_iCharSpace(0) { | 71 m_iCharSpace(0) { |
71 m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0; | 72 m_bPagination = (m_dwPolicies & FX_TXTBREAKPOLICY_Pagination) != 0; |
72 int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar); | 73 int32_t iSize = m_bPagination ? sizeof(CFX_Char) : sizeof(CFX_TxtChar); |
73 m_pTxtLine1.reset(new CFX_TxtLine(iSize)); | 74 m_pTxtLine1 = pdfium::MakeUnique<CFX_TxtLine>(iSize); |
74 m_pTxtLine2.reset(new CFX_TxtLine(iSize)); | 75 m_pTxtLine2 = pdfium::MakeUnique<CFX_TxtLine>(iSize); |
75 m_pCurLine = m_pTxtLine1.get(); | 76 m_pCurLine = m_pTxtLine1.get(); |
76 ResetArabicContext(); | 77 ResetArabicContext(); |
77 } | 78 } |
78 | 79 |
79 CFX_TxtBreak::~CFX_TxtBreak() { | 80 CFX_TxtBreak::~CFX_TxtBreak() { |
80 Reset(); | 81 Reset(); |
81 } | 82 } |
82 | 83 |
83 void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) { | 84 void CFX_TxtBreak::SetLineWidth(FX_FLOAT fLineWidth) { |
84 m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f); | 85 m_iLineWidth = FXSYS_round(fLineWidth * 20000.0f); |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) | 1737 CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize) |
1737 : m_pLineChars(new CFX_TxtCharArray), | 1738 : m_pLineChars(new CFX_TxtCharArray), |
1738 m_pLinePieces(new CFX_TxtPieceArray(16)), | 1739 m_pLinePieces(new CFX_TxtPieceArray(16)), |
1739 m_iStart(0), | 1740 m_iStart(0), |
1740 m_iWidth(0), | 1741 m_iWidth(0), |
1741 m_iArabicChars(0) {} | 1742 m_iArabicChars(0) {} |
1742 | 1743 |
1743 CFX_TxtLine::~CFX_TxtLine() { | 1744 CFX_TxtLine::~CFX_TxtLine() { |
1744 RemoveAll(); | 1745 RemoveAll(); |
1745 } | 1746 } |
OLD | NEW |