diff options
author | Nicolas Fella <nicolas.fella@kdab.com> | 2024-04-08 17:10:48 +0200 |
---|---|---|
committer | Nicolas Fella <nicolas.fella@gmx.de> | 2024-04-08 17:11:19 +0200 |
commit | 750bb558f094c8f25e53f212049fa83ee8f705b9 (patch) | |
tree | 0157db9ea811881096de988e958479ec26853331 | |
parent | 58f721067044baeee1ac56cdc679cc5e97dcbd69 (diff) |
Take border into account also for height when determining signature font size
The border reduces the available height, so take it into account for the height too, not only the width
-rw-r--r-- | poppler/Form.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/poppler/Form.cc b/poppler/Form.cc index c5891d94..46812869 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -742,11 +742,12 @@ bool FormWidgetSignature::signDocumentWithAppearance(const std::string &saveFile const double dx = std::get<0>(dxdy); const double dy = std::get<1>(dxdy); const double wMax = dx - 2 * borderWidth - 4; + const double hMax = dy - 2 * borderWidth; if (fontSize == 0) { - fontSize = Annot::calculateFontSize(form, font.get(), &signatureText, wMax / 2.0, dy); + fontSize = Annot::calculateFontSize(form, font.get(), &signatureText, wMax / 2.0, hMax); } if (leftFontSize == 0) { - leftFontSize = Annot::calculateFontSize(form, font.get(), &signatureTextLeft, wMax / 2.0, dy); + leftFontSize = Annot::calculateFontSize(form, font.get(), &signatureTextLeft, wMax / 2.0, hMax); } const DefaultAppearance da { { objName, pdfFontName.c_str() }, fontSize, std::move(fontColor) }; getField()->setDefaultAppearance(da.toAppearanceString()); |