diff options
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 14 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textpiece.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textpiece.h | 6 |
3 files changed, 12 insertions, 16 deletions
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 9735dc7b13..715dbb32dd 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -999,10 +999,10 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle, } else if (dwAlign == FX_HashCode_GetW(L"decimal", false)) { int32_t iChars = pPiece->iChars; for (int32_t i = 0; i < iChars; i++) { - if (pPiece->pszText[i] == L'.') + if (pPiece->szText[i] == L'.') break; - fLeft += pPiece->pWidths[i] / 20000.0f; + fLeft += pPiece->Widths[i] / 20000.0f; } } m_pTabstopContext->m_fLeft = @@ -1041,11 +1041,9 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus, FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; auto pTP = pdfium::MakeUnique<XFA_TextPiece>(); - pTP->pszText = FX_Alloc(FX_WCHAR, pPiece->m_iChars); - pTP->pWidths = FX_Alloc(int32_t, pPiece->m_iChars); pTP->iChars = pPiece->m_iChars; - pPiece->GetString(pTP->pszText); - pPiece->GetWidths(pTP->pWidths); + pTP->szText = pPiece->GetString(); + pTP->Widths = pPiece->GetWidths(); pTP->iBidiLevel = pPiece->m_iBidiLevel; pTP->iHorScale = pPiece->m_iHorizontalScale; pTP->iVerScale = pPiece->m_iVerticalScale; @@ -1301,10 +1299,10 @@ bool CXFA_TextLayout::ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ* tr) { if (iLength < 1) return false; - tr->pStr = pPiece->pszText; + tr->pStr = pPiece->szText; tr->pFont = pPiece->pFont; tr->pRect = &pPiece->rtPiece; - tr->pWidths = pPiece->pWidths; + tr->pWidths = pPiece->Widths; tr->iLength = iLength; tr->fFontSize = pPiece->fFontSize; tr->iBidiLevel = pPiece->iBidiLevel; diff --git a/xfa/fxfa/app/xfa_textpiece.cpp b/xfa/fxfa/app/xfa_textpiece.cpp index e65cc16667..c53e45f91a 100644 --- a/xfa/fxfa/app/xfa_textpiece.cpp +++ b/xfa/fxfa/app/xfa_textpiece.cpp @@ -8,10 +8,6 @@ #include "xfa/fxfa/app/cxfa_linkuserdata.h" -XFA_TextPiece::XFA_TextPiece() - : pszText(nullptr), pWidths(nullptr), pFont(nullptr) {} +XFA_TextPiece::XFA_TextPiece() {} -XFA_TextPiece::~XFA_TextPiece() { - FX_Free(pszText); - FX_Free(pWidths); -} +XFA_TextPiece::~XFA_TextPiece() {} diff --git a/xfa/fxfa/app/xfa_textpiece.h b/xfa/fxfa/app/xfa_textpiece.h index 6c7b3d4217..6802df5566 100644 --- a/xfa/fxfa/app/xfa_textpiece.h +++ b/xfa/fxfa/app/xfa_textpiece.h @@ -7,6 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_TEXTPIECE_H_ #define XFA_FXFA_APP_XFA_TEXTPIECE_H_ +#include <vector> + #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" @@ -20,9 +22,9 @@ class XFA_TextPiece { XFA_TextPiece(); ~XFA_TextPiece(); - FX_WCHAR* pszText; + CFX_WideString szText; + std::vector<int32_t> Widths; int32_t iChars; - int32_t* pWidths; int32_t iHorScale; int32_t iVerScale; int32_t iBidiLevel; |