Skip to content

Commit

Permalink
opensagres#246 Added better handling for default 'leading' value of a…
Browse files Browse the repository at this point in the history
… Paragraph.
  • Loading branch information
Ivo Majic committed Oct 16, 2017
1 parent 06f0770 commit d93cc23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ protected IITextContainer startVisitParagraph(XWPFParagraph docxParagraph,
.getMultipleLeading());
}
}

}

// text-align
Expand Down Expand Up @@ -488,6 +487,7 @@ protected void visitRun(XWPFRun docxRun, boolean pageNumber, String url,

StylableParagraph pdfParagraph = (StylableParagraph) pdfParagraphContainer;
pdfParagraph.adjustMultipliedLeading(currentRunFontAscii);
pdfParagraph.adjustLeading(currentRunFontAscii);

// addd symbol list item chunk if needed.
String listItemText = pdfParagraph.getListItemText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class StylableParagraph

private Color listItemFontColor;

private boolean defaultLeading = true;

public StylableParagraph( StylableDocument ownerDocument, IITextContainer parent )
{
super();
Expand Down Expand Up @@ -244,6 +246,7 @@ public void setLeading( float fixedLeading, float multipliedLeading )
{
super.setLeading( fixedLeading, multipliedLeading );
this.originMultipliedLeading = multipliedLeading;
this.defaultLeading = false;
}

@Override
Expand Down Expand Up @@ -276,4 +279,10 @@ public void adjustMultipliedLeading( Font font )
}
}

public void adjustLeading( Font font ){
if ( font != null ){
super.setLeading(font.getSize());
this.defaultLeading = false;
}
}
}

0 comments on commit d93cc23

Please sign in to comment.