summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdftext.cpp
diff options
context:
space:
mode:
authorAndrew Weintraub <asweintraub@google.com>2017-08-11 11:36:51 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-12 00:29:04 +0000
commitd3002340caad8d688d0e4928a36e90d354a797bd (patch)
treee87182d51b22e04ae553354655a061d9d099b1b7 /fpdfsdk/fpdftext.cpp
parent3c03439a81731233a5410fa4ea029721c021d42c (diff)
downloadpdfium-d3002340caad8d688d0e4928a36e90d354a797bd.tar.xz
Add a new public method to get the the origin of a character.
Bug: Change-Id: I376f4af26791cd4ed04049ab179c2b39dd262725 Reviewed-on: https://pdfium-review.googlesource.com/10690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdftext.cpp')
-rw-r--r--fpdfsdk/fpdftext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 70acf54ec7..2ea06de5d8 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -123,6 +123,24 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
*top = charinfo.m_CharBox.top;
}
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFText_GetCharOrigin(FPDF_TEXTPAGE text_page,
+ int index,
+ double* x,
+ double* y) {
+ if (!text_page)
+ return false;
+ CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
+
+ if (index < 0 || index >= textpage->CountChars())
+ return false;
+ FPDF_CHAR_INFO charinfo;
+ textpage->GetCharInfo(index, &charinfo);
+ *x = charinfo.m_Origin.x;
+ *y = charinfo.m_Origin.y;
+ return true;
+}
+
// select
FPDF_EXPORT int FPDF_CALLCONV
FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,