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 "core/fpdftext/include/cpdf_textpage.h" | 7 #include "core/fpdftext/include/cpdf_textpage.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 CFX_FloatRect(charinfo.m_OriginX, charinfo.m_OriginY, | 1124 CFX_FloatRect(charinfo.m_OriginX, charinfo.m_OriginY, |
1125 charinfo.m_OriginX, charinfo.m_OriginY); | 1125 charinfo.m_OriginX, charinfo.m_OriginY); |
1126 m_TempCharList.push_back(charinfo); | 1126 m_TempCharList.push_back(charinfo); |
1127 } | 1127 } |
1128 if (item.m_CharCode == CPDF_Font::kInvalidCharCode) | 1128 if (item.m_CharCode == CPDF_Font::kInvalidCharCode) |
1129 continue; | 1129 continue; |
1130 } | 1130 } |
1131 spacing = 0; | 1131 spacing = 0; |
1132 CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); | 1132 CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); |
1133 bool bNoUnicode = false; | 1133 bool bNoUnicode = false; |
1134 FX_WCHAR wChar = wstrItem.GetAt(0); | 1134 if (wstrItem.IsEmpty() && item.m_CharCode) { |
1135 if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) { | 1135 wstrItem += static_cast<FX_WCHAR>(item.m_CharCode); |
1136 if (wstrItem.IsEmpty()) | |
1137 wstrItem += (FX_WCHAR)item.m_CharCode; | |
1138 else | |
1139 wstrItem.SetAt(0, (FX_WCHAR)item.m_CharCode); | |
1140 bNoUnicode = true; | 1136 bNoUnicode = true; |
1141 } | 1137 } |
1142 charinfo.m_Index = -1; | 1138 charinfo.m_Index = -1; |
1143 charinfo.m_CharCode = item.m_CharCode; | 1139 charinfo.m_CharCode = item.m_CharCode; |
1144 if (bNoUnicode) | 1140 if (bNoUnicode) |
1145 charinfo.m_Flag = FPDFTEXT_CHAR_UNUNICODE; | 1141 charinfo.m_Flag = FPDFTEXT_CHAR_UNUNICODE; |
1146 else | 1142 else |
1147 charinfo.m_Flag = FPDFTEXT_CHAR_NORMAL; | 1143 charinfo.m_Flag = FPDFTEXT_CHAR_NORMAL; |
1148 charinfo.m_pTextObj = pTextObj; | 1144 charinfo.m_pTextObj = pTextObj; |
1149 charinfo.m_OriginX = 0, charinfo.m_OriginY = 0; | 1145 charinfo.m_OriginX = 0, charinfo.m_OriginY = 0; |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 info.m_OriginY); | 1533 info.m_OriginY); |
1538 return TRUE; | 1534 return TRUE; |
1539 } | 1535 } |
1540 | 1536 |
1541 FX_BOOL CPDF_TextPage::IsRectIntersect(const CFX_FloatRect& rect1, | 1537 FX_BOOL CPDF_TextPage::IsRectIntersect(const CFX_FloatRect& rect1, |
1542 const CFX_FloatRect& rect2) { | 1538 const CFX_FloatRect& rect2) { |
1543 CFX_FloatRect rect = rect1; | 1539 CFX_FloatRect rect = rect1; |
1544 rect.Intersect(rect2); | 1540 rect.Intersect(rect2); |
1545 return !rect.IsEmpty(); | 1541 return !rect.IsEmpty(); |
1546 } | 1542 } |
OLD | NEW |