Commit e7e9721b authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid
Browse files

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
parent da226d34
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment