diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-11 09:09:10 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-11 10:20:50 +0100 |
commit | ab882c0506c886eb32d8de0d2441de94920598bc (patch) | |
tree | ebcbfb39bbbe4fac2076b0bd0a1cd025e79a37ee /vcl/source/pdf | |
parent | ef0be13a2aff3fe42a99c0c92a7c39e23c864bfe (diff) |
pdfium: add a FPDFText_GetCharBox() wrapper
Which was the last public use of PDFiumTextPage::getPointer().
Change-Id: If3339f09ba38a3f10b19fe85cded718c913eb067
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110750
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source/pdf')
-rw-r--r-- | vcl/source/pdf/PDFiumLibrary.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 278fb284901d..c14a73ddd469 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -24,6 +24,7 @@ #include <osl/endian.h> #include <vcl/bitmap.hxx> #include <tools/stream.hxx> +#include <tools/UnitConversion.hxx> #include <bitmap/BitmapWriteAccess.hxx> @@ -1120,6 +1121,26 @@ PDFiumTextPage::~PDFiumTextPage() int PDFiumTextPage::countChars() { return FPDFText_CountChars(mpTextPage); } +basegfx::B2DRectangle PDFiumTextPage::getCharBox(int nIndex, double fPageHeight) +{ + double left = 0.0; + double right = 0.0; + double bottom = 0.0; + double top = 0.0; + + if (FPDFText_GetCharBox(mpTextPage, nIndex, &left, &right, &bottom, &top)) + { + left = convertPointToMm100(left); + right = convertPointToMm100(right); + top = fPageHeight - convertPointToMm100(top); + bottom = fPageHeight - convertPointToMm100(bottom); + + return basegfx::B2DRectangle(left, bottom, right, top); + } + + return basegfx::B2DRectangle(); +} + unsigned int PDFiumTextPage::getUnicode(int index) { return FPDFText_GetUnicode(mpTextPage, index); |