poppler/Annot.cc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e7e9721b120876cddf16fc98a605ecb49dc44620
Author: Albert Astals Cid <aa...@kde.org>
Date:   Tue May 24 17:11:05 2022 +0200

    Annot: Fix first lines of Annotations sometimes being cut off
    
    What we're calculating in those two places is the top left corner for
    where to draw the character substracting the descent doesn't make any
    sense.
    
    Bug #1246

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 4d13a374..86de45a2 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -3324,7 +3324,7 @@ void AnnotFreeText::generateFreeTextAppearance()
 
     // Set font state
     appearBuilder.setDrawColor(da.getFontColor(), true);
-    appearBuilder.appendf("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, 
height - textmargin - da.getFontPtSize() * font->getDescent());
+    appearBuilder.appendf("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, 
height - textmargin);
     const DrawMultiLineTextResult textCommands = drawMultiLineText(*contents, 
textwidth, form, *font, da.getFontName().getName(), da.getFontPtSize(), 
quadding, 0 /*borderWidth*/);
     appearBuilder.append(textCommands.text.c_str());
     appearBuilder.append("ET Q\n");
@@ -5307,7 +5307,7 @@ void AnnotAppearanceBuilder::drawSignatureFieldText(const 
GooString &text, const
     const DrawMultiLineTextResult textCommands =
             drawMultiLineText(text, textwidth, form, *font, 
da.getFontName().getName(), da.getFontPtSize(), centerHorizontally ? 
VariableTextQuadding::centered : VariableTextQuadding::leftJustified, 0 
/*borderWidth*/);
 
-    double yDelta = height - textmargin - da.getFontPtSize() * 
font->getDescent();
+    double yDelta = height - textmargin;
     if (centerVertically) {
         const double outTextHeight = textCommands.nLines * da.getFontPtSize();
         if (outTextHeight < height) {

Reply via email to