diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-05-20 15:17:16 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-05-22 12:17:20 +0200 |
commit | b29879a233e7cdb4162092483752c2f6d13733aa (patch) | |
tree | 8f230d764ac87e84461c65c6429a6cb6a2e6af2b /svx | |
parent | d4eaa026efde056ad4d429bccaa0b18f0388d6ec (diff) |
svx: set the font name of imported PDF text
Change-Id: I79dde3c8983a70311de2d2a46093fac2722fb372
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 4aa05fb30551..6855395b0ab8 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -924,6 +924,20 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex mbFntDirty = true; } + std::unique_ptr<char[]> pFontName(new char[80 + 1]); // + terminating null + char* pCharFontName = reinterpret_cast<char*>(pFontName.get()); + int nFontNameChars = FPDFTextObj_GetFontName(pPageObject, pCharFontName); + if (nFontNameChars > 0) + { + OUString sFontName = OUString::createFromAscii(pFontName.get()); + if (sFontName != aFnt.GetFamilyName()) + { + aFnt.SetFamilyName(sFontName); + mpVD->SetFont(aFnt); + mbFntDirty = true; + } + } + Color aTextColor(COL_TRANSPARENT); unsigned int nR, nG, nB, nA; if (FPDFTextObj_GetColor(pPageObject, &nR, &nG, &nB, &nA)) @@ -1206,11 +1220,11 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int /*nPageObjectI if (!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aPolyPoly))) { - SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aPolyPoly); - pPath->SetModel(mpModel); - SetAttributes(pPath); - InsertObj(pPath, false); -} + SdrPathObj *pPath = new SdrPathObj(OBJ_POLY, aPolyPoly); + pPath->SetModel(mpModel); + SetAttributes(pPath); + InsertObj(pPath, false); + } } Point ImpSdrPdfImport::PointsToLogic(double x, double y) const |