fix a leak, add some table features

This commit is contained in:
Alex Fabijanic
2020-01-15 22:06:45 +01:00
committed by Günter Obiltschnig
parent 854bf4d79f
commit b435db6e8e
7 changed files with 94 additions and 15 deletions

8
PDF/src/Page.cpp Normal file → Executable file
View File

@@ -49,6 +49,7 @@ Page::Page(const Page& other):
Page::~Page()
{
delete _pCurrentFont;
}
@@ -120,8 +121,11 @@ void Page::setTTFont(const std::string& name, float size, const std::string& enc
const Font& Page::getFont() const
{
delete _pCurrentFont;
return *(_pCurrentFont = new Font(&_pDocument->handle(), HPDF_Page_GetCurrentFont(_page)));
delete _pCurrentFont; _pCurrentFont = 0;
HPDF_Font pCurFont = HPDF_Page_GetCurrentFont(_page);
if (!pCurFont) throw Poco::NullPointerException("PDF::Page has no font set.");
_pCurrentFont = new Font(&_pDocument->handle(), pCurFont);
return *_pCurrentFont;
}