Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 801913002: Simplify PDFium by removing code that's not used in the open source repo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "../../include/fpdfapi/fpdf_resource.h" 7 #include "../../include/fpdfapi/fpdf_resource.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../include/fpdftext/fpdf_text.h" 9 #include "../../include/fpdftext/fpdf_text.h"
10 #include "../../include/fpdfapi/fpdf_page.h" 10 #include "../../include/fpdfapi/fpdf_page.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if(nCount) { 153 if(nCount) {
154 m_CharIndex.Add(0); 154 m_CharIndex.Add(0);
155 } 155 }
156 for(int i = 0; i < nCount; i++) { 156 for(int i = 0; i < nCount; i++) {
157 int indexSize = m_CharIndex.GetSize(); 157 int indexSize = m_CharIndex.GetSize();
158 FX_BOOL bNormal = FALSE; 158 FX_BOOL bNormal = FALSE;
159 PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(i); 159 PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(i);
160 if(charinfo.m_Flag == FPDFTEXT_CHAR_GENERATED) { 160 if(charinfo.m_Flag == FPDFTEXT_CHAR_GENERATED) {
161 bNormal = TRUE; 161 bNormal = TRUE;
162 } 162 }
163 #ifdef FOXIT_CHROME_BUILD
164 else if(charinfo.m_Unicode == 0 || IsControlChar(&charinfo)) 163 else if(charinfo.m_Unicode == 0 || IsControlChar(&charinfo))
165 #else
166 else if(charinfo.m_Unicode == 0)
167 #endif
168 bNormal = FALSE; 164 bNormal = FALSE;
169 else { 165 else {
170 bNormal = TRUE; 166 bNormal = TRUE;
171 } 167 }
172 if(bNormal) { 168 if(bNormal) {
173 if(indexSize % 2) { 169 if(indexSize % 2) {
174 m_CharIndex.Add(1); 170 m_CharIndex.Add(1);
175 } else { 171 } else {
176 if(indexSize <= 0) { 172 if(indexSize <= 0) {
177 continue; 173 continue;
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 for(int i = start; i < end; i++) { 1107 for(int i = start; i < end; i++) {
1112 m_TextBuf.AppendChar(str.GetAt(i)); 1108 m_TextBuf.AppendChar(str.GetAt(i));
1113 m_charList.Add(*(PAGECHAR_INFO*)m_TempCharList.GetAt(i)); 1109 m_charList.Add(*(PAGECHAR_INFO*)m_TempCharList.GetAt(i));
1114 } 1110 }
1115 } 1111 }
1116 } 1112 }
1117 void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) 1113 void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i)
1118 { 1114 {
1119 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); 1115 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i);
1120 FX_WCHAR wChar = str.GetAt(i); 1116 FX_WCHAR wChar = str.GetAt(i);
1121 #ifdef FOXIT_CHROME_BUILD
1122 if(!IsControlChar(&Info)) { 1117 if(!IsControlChar(&Info)) {
1123 #else
1124 if(wChar != 0xfffe) {
1125 #endif
1126 Info.m_Index = m_TextBuf.GetLength(); 1118 Info.m_Index = m_TextBuf.GetLength();
1127 if (wChar >= 0xFB00 && wChar <= 0xFB06) { 1119 if (wChar >= 0xFB00 && wChar <= 0xFB06) {
1128 FX_LPWSTR pDst = NULL; 1120 FX_LPWSTR pDst = NULL;
1129 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); 1121 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
1130 if (nCount >= 1) { 1122 if (nCount >= 1) {
1131 pDst = FX_Alloc(FX_WCHAR, nCount); 1123 pDst = FX_Alloc(FX_WCHAR, nCount);
1132 if (!pDst) { 1124 if (!pDst) {
1133 return; 1125 return;
1134 } 1126 }
1135 FX_Unicode_GetNormalization(wChar, pDst); 1127 FX_Unicode_GetNormalization(wChar, pDst);
(...skipping 14 matching lines...) Expand all
1150 } else { 1142 } else {
1151 Info.m_Index = -1; 1143 Info.m_Index = -1;
1152 } 1144 }
1153 if( !m_ParseOptions.m_bGetCharCodeOnly) { 1145 if( !m_ParseOptions.m_bGetCharCodeOnly) {
1154 m_charList.Add(Info); 1146 m_charList.Add(Info);
1155 } 1147 }
1156 } 1148 }
1157 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) 1149 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i)
1158 { 1150 {
1159 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); 1151 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i);
1160 #ifdef FOXIT_CHROME_BUILD
1161 if(!IsControlChar(&Info)) { 1152 if(!IsControlChar(&Info)) {
1162 #else
1163 if(str.GetAt(i) != 0xfffe) {
1164 #endif
1165 Info.m_Index = m_TextBuf.GetLength(); 1153 Info.m_Index = m_TextBuf.GetLength();
1166 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); 1154 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE);
1167 FX_LPWSTR pDst = NULL; 1155 FX_LPWSTR pDst = NULL;
1168 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); 1156 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
1169 if (nCount >= 1) { 1157 if (nCount >= 1) {
1170 pDst = FX_Alloc(FX_WCHAR, nCount); 1158 pDst = FX_Alloc(FX_WCHAR, nCount);
1171 if (!pDst) { 1159 if (!pDst) {
1172 return; 1160 return;
1173 } 1161 }
1174 FX_Unicode_GetNormalization(wChar, pDst); 1162 FX_Unicode_GetNormalization(wChar, pDst);
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 if (0x2D == curChar || 0xAD == curChar) { 1619 if (0x2D == curChar || 0xAD == curChar) {
1632 return; 1620 return;
1633 } 1621 }
1634 } 1622 }
1635 while (m_TempTextBuf.GetSize() > 0 && m_TempTextBuf.GetWideString(). GetAt(m_TempTextBuf.GetLength() - 1) == 0x20) { 1623 while (m_TempTextBuf.GetSize() > 0 && m_TempTextBuf.GetWideString(). GetAt(m_TempTextBuf.GetLength() - 1) == 0x20) {
1636 m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1); 1624 m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
1637 m_TempCharList.Delete(m_TempCharList.GetSize() - 1); 1625 m_TempCharList.Delete(m_TempCharList.GetSize() - 1);
1638 } 1626 }
1639 PAGECHAR_INFO* cha = (PAGECHAR_INFO*)m_TempCharList.GetAt(m_TempChar List.GetSize() - 1); 1627 PAGECHAR_INFO* cha = (PAGECHAR_INFO*)m_TempCharList.GetAt(m_TempChar List.GetSize() - 1);
1640 m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1); 1628 m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
1641 #ifdef FOXIT_CHROME_BUILD
1642 cha->m_Unicode = 0x2; 1629 cha->m_Unicode = 0x2;
1643 cha->m_Flag = FPDFTEXT_CHAR_HYPHEN; 1630 cha->m_Flag = FPDFTEXT_CHAR_HYPHEN;
1644 m_TempTextBuf.AppendChar(0xfffe); 1631 m_TempTextBuf.AppendChar(0xfffe);
1645 #else
1646 cha->m_Unicode = 0;
1647 m_TempTextBuf.AppendChar(0xfffe);
1648 #endif
1649 } 1632 }
1650 } else { 1633 } else {
1651 m_CurlineRect = CFX_FloatRect(Obj.m_pTextObj->m_Left, Obj.m_pTextObj->m_ Bottom, Obj.m_pTextObj->m_Right, Obj.m_pTextObj->m_Top); 1634 m_CurlineRect = CFX_FloatRect(Obj.m_pTextObj->m_Left, Obj.m_pTextObj->m_ Bottom, Obj.m_pTextObj->m_Right, Obj.m_pTextObj->m_Top);
1652 } 1635 }
1653 if (FPDFTEXT_MC_DELAY == bPreMKC) { 1636 if (FPDFTEXT_MC_DELAY == bPreMKC) {
1654 ProcessMarkedContent(Obj); 1637 ProcessMarkedContent(Obj);
1655 m_pPreTextObj = pTextObj; 1638 m_pPreTextObj = pTextObj;
1656 m_perMatrix.Copy(formMatrix); 1639 m_perMatrix.Copy(formMatrix);
1657 return; 1640 return;
1658 } 1641 }
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2848 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2831 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2849 return; 2832 return;
2850 } 2833 }
2851 CPDF_LinkExt* link = NULL; 2834 CPDF_LinkExt* link = NULL;
2852 link = m_LinkList.GetAt(index); 2835 link = m_LinkList.GetAt(index);
2853 if (!link) { 2836 if (!link) {
2854 return ; 2837 return ;
2855 } 2838 }
2856 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2839 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2857 } 2840 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698