include/vcl/filter/PDFiumLibrary.hxx | 1 + vcl/source/pdf/PDFiumLibrary.cxx | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
New commits: commit 186588bd4364e682431794e3ab6195c051237775 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Aug 21 16:03:28 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Oct 13 11:21:02 2025 +0200 make base/postscript fontname available Change-Id: Ie31edc03613c0325282667c83123b067bbb809f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191467 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 2f8c8962f0a9ee1c17d335c8c4d7e286d2072fc3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192267 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index ee6041f6783c..0fceef9d0b81 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -156,6 +156,7 @@ public: virtual basegfx::B2DRectangle getBounds() = 0; virtual double getFontSize() = 0; virtual OUString getFontName() = 0; + virtual OUString getBaseFontName() = 0; virtual int getFontAngle() = 0; virtual bool getFontData(std::vector<uint8_t>& rData) = 0; virtual bool getFontProperties(FontWeight& weight) = 0; diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 150a83bd4b7d..76bb12bcaa0e 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -416,6 +416,7 @@ public: basegfx::B2DRectangle getBounds() override; double getFontSize() override; OUString getFontName() override; + OUString getBaseFontName() override; int getFontAngle() override; bool getFontData(std::vector<uint8_t>& rData) override; bool getFontProperties(FontWeight& weight) override; @@ -1141,6 +1142,21 @@ double PDFiumPageObjectImpl::getFontSize() return nSize; } +OUString PDFiumPageObjectImpl::getBaseFontName() +{ + OUString sBaseFontName; + const int nBaseFontName = 80 + 1; + std::unique_ptr<char[]> pBaseFontName(new char[nBaseFontName]); // + terminating null + FPDF_FONT pFontObject = FPDFTextObj_GetFont(mpPageObject); + int nBaseFontNameChars + = FPDFFont_GetBaseFontName(pFontObject, pBaseFontName.get(), nBaseFontName); + if (nBaseFontName >= nBaseFontNameChars) + { + sBaseFontName = OUString::createFromAscii(pBaseFontName.get()); + } + return sBaseFontName; +} + OUString PDFiumPageObjectImpl::getFontName() { OUString sFamilyName;
