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 "public/fpdf_text.h" | 7 #include "public/fpdf_text.h" |
8 | 8 |
9 #include "core/include/fpdfdoc/fpdf_doc.h" | 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
10 #include "core/include/fpdftext/fpdf_text.h" | 10 #include "core/include/fpdftext/fpdf_text.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { | 27 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
28 delete (IPDF_TextPage*)text_page; | 28 delete (IPDF_TextPage*)text_page; |
29 } | 29 } |
30 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { | 30 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
31 if (!text_page) | 31 if (!text_page) |
32 return -1; | 32 return -1; |
33 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 33 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
34 return textpage->CountChars(); | 34 return textpage->CountChars(); |
35 } | 35 } |
| 36 |
36 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, | 37 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
37 int index) { | 38 int index) { |
38 if (!text_page) | 39 if (!text_page) |
39 return -1; | 40 return -1; |
40 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 41 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
41 | 42 |
42 if (index < 0 || index >= textpage->CountChars()) | 43 if (index < 0 || index >= textpage->CountChars()) |
43 return 0; | 44 return 0; |
44 | 45 |
45 FPDF_CHAR_INFO charinfo; | 46 FPDF_CHAR_INFO charinfo; |
46 textpage->GetCharInfo(index, charinfo); | 47 textpage->GetCharInfo(index, &charinfo); |
47 return charinfo.m_Unicode; | 48 return charinfo.m_Unicode; |
48 } | 49 } |
| 50 |
49 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, | 51 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
50 int index) { | 52 int index) { |
51 if (!text_page) | 53 if (!text_page) |
52 return 0; | 54 return 0; |
53 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 55 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
54 | 56 |
55 if (index < 0 || index >= textpage->CountChars()) | 57 if (index < 0 || index >= textpage->CountChars()) |
56 return 0; | 58 return 0; |
57 | 59 |
58 FPDF_CHAR_INFO charinfo; | 60 FPDF_CHAR_INFO charinfo; |
59 textpage->GetCharInfo(index, charinfo); | 61 textpage->GetCharInfo(index, &charinfo); |
60 return charinfo.m_FontSize; | 62 return charinfo.m_FontSize; |
61 } | 63 } |
62 | 64 |
63 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, | 65 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
64 int index, | 66 int index, |
65 double* left, | 67 double* left, |
66 double* right, | 68 double* right, |
67 double* bottom, | 69 double* bottom, |
68 double* top) { | 70 double* top) { |
69 if (!text_page) | 71 if (!text_page) |
70 return; | 72 return; |
71 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 73 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
72 | 74 |
73 if (index < 0 || index >= textpage->CountChars()) | 75 if (index < 0 || index >= textpage->CountChars()) |
74 return; | 76 return; |
75 FPDF_CHAR_INFO charinfo; | 77 FPDF_CHAR_INFO charinfo; |
76 textpage->GetCharInfo(index, charinfo); | 78 textpage->GetCharInfo(index, &charinfo); |
77 *left = charinfo.m_CharBox.left; | 79 *left = charinfo.m_CharBox.left; |
78 *right = charinfo.m_CharBox.right; | 80 *right = charinfo.m_CharBox.right; |
79 *bottom = charinfo.m_CharBox.bottom; | 81 *bottom = charinfo.m_CharBox.bottom; |
80 *top = charinfo.m_CharBox.top; | 82 *top = charinfo.m_CharBox.top; |
81 } | 83 } |
82 | 84 |
83 // select | 85 // select |
84 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, | 86 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
85 double x, | 87 double x, |
86 double y, | 88 double y, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 CFX_FloatRect rect = rectArray.GetAt(rect_index); | 279 CFX_FloatRect rect = rectArray.GetAt(rect_index); |
278 *left = rect.left; | 280 *left = rect.left; |
279 *right = rect.right; | 281 *right = rect.right; |
280 *top = rect.top; | 282 *top = rect.top; |
281 *bottom = rect.bottom; | 283 *bottom = rect.bottom; |
282 } | 284 } |
283 } | 285 } |
284 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { | 286 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
285 delete (IPDF_LinkExtract*)link_page; | 287 delete (IPDF_LinkExtract*)link_page; |
286 } | 288 } |
OLD | NEW |