summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-25 14:43:46 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-25 14:43:46 -0800
commitb210651db6a965ad50d726a4bb872580e93d2ae9 (patch)
tree34b566489fbcaa2af51a7e8d0e701c3b3d908d3d
parent628f7053cc646c58c61add247c75bc65ac135327 (diff)
downloadpdfium-b210651db6a965ad50d726a4bb872580e93d2ae9.tar.xz
Re-order methods to make xfa diff saner
Precursor to making fpdf_text_int.cpp match cleanly. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1477433006 .
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 4ed11e3986..ee768af3bc 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -1421,6 +1421,62 @@ void CPDF_TextPage::FindPreviousTextObject(void) {
m_pPreTextObj = preChar.m_pTextObj;
}
}
+void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
+ int32_t iBufStartAppend) {
+ int32_t i, j;
+ i = iCharListStartAppend;
+ j = m_TempCharList.GetSize() - 1;
+ for (; i < j; i++, j--) {
+ std::swap(m_TempCharList[i], m_TempCharList[j]);
+ std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
+ }
+ FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
+ i = iBufStartAppend;
+ j = m_TempTextBuf.GetLength() - 1;
+ for (; i < j; i++, j--) {
+ std::swap(pTempBuffer[i], pTempBuffer[j]);
+ }
+}
+FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
+ const CPDF_Font* pFont,
+ int nItems) const {
+ nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
+ int32_t nR2L = 0;
+ int32_t nL2R = 0;
+ int32_t start = 0, count = 0;
+ CPDF_TextObjectItem item;
+ for (int32_t i = 0; i < nItems; i++) {
+ pTextObj->GetItemInfo(i, &item);
+ if (item.m_CharCode == (FX_DWORD)-1) {
+ continue;
+ }
+ CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ FX_WCHAR wChar = wstrItem.GetAt(0);
+ if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) {
+ wChar = (FX_WCHAR)item.m_CharCode;
+ }
+ if (!wChar) {
+ continue;
+ }
+ if (pBidiChar->AppendChar(wChar)) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
+ nR2L++;
+ } else if (ret == CFX_BidiChar::LEFT) {
+ nL2R++;
+ }
+ }
+ }
+ if (pBidiChar->EndChar()) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
+ nR2L++;
+ } else if (ret == CFX_BidiChar::LEFT) {
+ nL2R++;
+ }
+ }
+ return (nR2L > 0 && nR2L >= nL2R);
+}
void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) {
@@ -1689,62 +1745,6 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
SwapTempTextBuf(iCharListStartAppend, iBufStartAppend);
}
}
-void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
- int32_t iBufStartAppend) {
- int32_t i, j;
- i = iCharListStartAppend;
- j = m_TempCharList.GetSize() - 1;
- for (; i < j; i++, j--) {
- std::swap(m_TempCharList[i], m_TempCharList[j]);
- std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
- }
- FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
- i = iBufStartAppend;
- j = m_TempTextBuf.GetLength() - 1;
- for (; i < j; i++, j--) {
- std::swap(pTempBuffer[i], pTempBuffer[j]);
- }
-}
-FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
- const CPDF_Font* pFont,
- int nItems) const {
- nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
- int32_t nR2L = 0;
- int32_t nL2R = 0;
- int32_t start = 0, count = 0;
- CPDF_TextObjectItem item;
- for (int32_t i = 0; i < nItems; i++) {
- pTextObj->GetItemInfo(i, &item);
- if (item.m_CharCode == (FX_DWORD)-1) {
- continue;
- }
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
- FX_WCHAR wChar = wstrItem.GetAt(0);
- if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) {
- wChar = (FX_WCHAR)item.m_CharCode;
- }
- if (!wChar) {
- continue;
- }
- if (pBidiChar->AppendChar(wChar)) {
- CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
- if (ret == CFX_BidiChar::RIGHT) {
- nR2L++;
- } else if (ret == CFX_BidiChar::LEFT) {
- nL2R++;
- }
- }
- }
- if (pBidiChar->EndChar()) {
- CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
- if (ret == CFX_BidiChar::RIGHT) {
- nR2L++;
- } else if (ret == CFX_BidiChar::LEFT) {
- nL2R++;
- }
- }
- return (nR2L > 0 && nR2L >= nL2R);
-}
int32_t CPDF_TextPage::GetTextObjectWritingMode(
const CPDF_TextObject* pTextObj) {
int32_t nChars = pTextObj->CountChars();