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 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { | 38 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
39 delete (IPDF_TextPage*)text_page; | 39 delete (IPDF_TextPage*)text_page; |
40 } | 40 } |
41 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { | 41 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
42 if (!text_page) | 42 if (!text_page) |
43 return -1; | 43 return -1; |
44 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 44 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
45 return textpage->CountChars(); | 45 return textpage->CountChars(); |
46 } | 46 } |
| 47 |
47 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, | 48 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
48 int index) { | 49 int index) { |
49 if (!text_page) | 50 if (!text_page) |
50 return -1; | 51 return -1; |
51 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 52 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
52 | 53 |
53 if (index < 0 || index >= textpage->CountChars()) | 54 if (index < 0 || index >= textpage->CountChars()) |
54 return 0; | 55 return 0; |
55 | 56 |
56 FPDF_CHAR_INFO charinfo; | 57 FPDF_CHAR_INFO charinfo; |
57 textpage->GetCharInfo(index, charinfo); | 58 textpage->GetCharInfo(index, &charinfo); |
58 return charinfo.m_Unicode; | 59 return charinfo.m_Unicode; |
59 } | 60 } |
| 61 |
60 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, | 62 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
61 int index) { | 63 int index) { |
62 if (!text_page) | 64 if (!text_page) |
63 return 0; | 65 return 0; |
64 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 66 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
65 | 67 |
66 if (index < 0 || index >= textpage->CountChars()) | 68 if (index < 0 || index >= textpage->CountChars()) |
67 return 0; | 69 return 0; |
68 | 70 |
69 FPDF_CHAR_INFO charinfo; | 71 FPDF_CHAR_INFO charinfo; |
70 textpage->GetCharInfo(index, charinfo); | 72 textpage->GetCharInfo(index, &charinfo); |
71 return charinfo.m_FontSize; | 73 return charinfo.m_FontSize; |
72 } | 74 } |
73 | 75 |
74 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, | 76 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
75 int index, | 77 int index, |
76 double* left, | 78 double* left, |
77 double* right, | 79 double* right, |
78 double* bottom, | 80 double* bottom, |
79 double* top) { | 81 double* top) { |
80 if (!text_page) | 82 if (!text_page) |
81 return; | 83 return; |
82 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; | 84 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
83 | 85 |
84 if (index < 0 || index >= textpage->CountChars()) | 86 if (index < 0 || index >= textpage->CountChars()) |
85 return; | 87 return; |
86 FPDF_CHAR_INFO charinfo; | 88 FPDF_CHAR_INFO charinfo; |
87 textpage->GetCharInfo(index, charinfo); | 89 textpage->GetCharInfo(index, &charinfo); |
88 *left = charinfo.m_CharBox.left; | 90 *left = charinfo.m_CharBox.left; |
89 *right = charinfo.m_CharBox.right; | 91 *right = charinfo.m_CharBox.right; |
90 *bottom = charinfo.m_CharBox.bottom; | 92 *bottom = charinfo.m_CharBox.bottom; |
91 *top = charinfo.m_CharBox.top; | 93 *top = charinfo.m_CharBox.top; |
92 } | 94 } |
93 | 95 |
94 // select | 96 // select |
95 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, | 97 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
96 double x, | 98 double x, |
97 double y, | 99 double y, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 CFX_FloatRect rect = rectArray.GetAt(rect_index); | 290 CFX_FloatRect rect = rectArray.GetAt(rect_index); |
289 *left = rect.left; | 291 *left = rect.left; |
290 *right = rect.right; | 292 *right = rect.right; |
291 *top = rect.top; | 293 *top = rect.top; |
292 *bottom = rect.bottom; | 294 *bottom = rect.bottom; |
293 } | 295 } |
294 } | 296 } |
295 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { | 297 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
296 delete (IPDF_LinkExtract*)link_page; | 298 delete (IPDF_LinkExtract*)link_page; |
297 } | 299 } |
OLD | NEW |