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/fpdf_text_int.h" | 7 #include "core/fpdftext/fpdf_text_int.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 899 |
900 int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const { | 900 int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const { |
901 if (charCode == CPDF_Font::kInvalidCharCode) | 901 if (charCode == CPDF_Font::kInvalidCharCode) |
902 return 0; | 902 return 0; |
903 | 903 |
904 if (int w = pFont->GetCharWidthF(charCode)) | 904 if (int w = pFont->GetCharWidthF(charCode)) |
905 return w; | 905 return w; |
906 | 906 |
907 CFX_ByteString str; | 907 CFX_ByteString str; |
908 pFont->AppendChar(str, charCode); | 908 pFont->AppendChar(str, charCode); |
909 if (int w = pFont->GetStringWidth(str, 1)) | 909 if (int w = pFont->GetStringWidth(str.c_str(), 1)) |
910 return w; | 910 return w; |
911 | 911 |
912 return pFont->GetCharBBox(charCode).Width(); | 912 return pFont->GetCharBBox(charCode).Width(); |
913 } | 913 } |
914 | 914 |
915 void CPDF_TextPage::OnPiece(CFX_BidiChar* pBidi, CFX_WideString& str) { | 915 void CPDF_TextPage::OnPiece(CFX_BidiChar* pBidi, CFX_WideString& str) { |
916 CFX_BidiChar::Segment seg = pBidi->GetSegmentInfo(); | 916 CFX_BidiChar::Segment seg = pBidi->GetSegmentInfo(); |
917 if (seg.direction == CFX_BidiChar::RIGHT) { | 917 if (seg.direction == CFX_BidiChar::RIGHT) { |
918 for (int i = seg.start + seg.count; i > seg.start; i--) { | 918 for (int i = seg.start + seg.count; i > seg.start; i--) { |
919 m_TextBuf.AppendChar(str.GetAt(i - i)); | 919 m_TextBuf.AppendChar(str.GetAt(i - i)); |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { | 2511 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { |
2512 return; | 2512 return; |
2513 } | 2513 } |
2514 CPDF_LinkExt* link = NULL; | 2514 CPDF_LinkExt* link = NULL; |
2515 link = m_LinkList.GetAt(index); | 2515 link = m_LinkList.GetAt(index); |
2516 if (!link) { | 2516 if (!link) { |
2517 return; | 2517 return; |
2518 } | 2518 } |
2519 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2519 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
2520 } | 2520 } |
OLD | NEW |