Skip to content

Commit

Permalink
Refactored the Java2DRendererBuilder and the PdfRendererBuilder in
Browse files Browse the repository at this point in the history
a base class as they share a big amount of code. Also MathML and LaTeX
support is now also in Java2D.
  • Loading branch information
rototor committed Feb 15, 2018
1 parent a5fe1e1 commit 7813ee1
Show file tree
Hide file tree
Showing 11 changed files with 630 additions and 730 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.logging.Level;

import com.openhtmltopdf.css.sheet.FontFaceRule;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -281,7 +282,7 @@ public void removeStyle(Element e) {
}
}

public List getFontFaceRules() {
public List<FontFaceRule> getFontFaceRules() {
return _matcher.getFontFaceRules();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
import com.openhtmltopdf.css.extend.AttributeResolver;
import com.openhtmltopdf.css.extend.StylesheetFactory;
import com.openhtmltopdf.css.extend.TreeResolver;
import com.openhtmltopdf.css.sheet.MediaRule;
import com.openhtmltopdf.css.sheet.PageRule;
import com.openhtmltopdf.css.sheet.Ruleset;
import com.openhtmltopdf.css.sheet.Stylesheet;
import com.openhtmltopdf.css.sheet.*;
import com.openhtmltopdf.util.Util;
import com.openhtmltopdf.util.XRLog;

Expand All @@ -61,7 +58,7 @@ public class Matcher {
private Set _visitElements;

private List _pageRules;
private List _fontFaceRules;
private List<FontFaceRule> _fontFaceRules;

public Matcher(
TreeResolver tr, AttributeResolver ar, StylesheetFactory factory, List stylesheets, String medium) {
Expand All @@ -71,7 +68,7 @@ public Matcher(
_styleFactory = factory;

_pageRules = new ArrayList();
_fontFaceRules = new ArrayList();
_fontFaceRules = new ArrayList<FontFaceRule>();
docMapper = createDocumentMapper(stylesheets, medium);
}

Expand Down Expand Up @@ -125,7 +122,7 @@ public PageInfo getPageCascadedStyle(String pageName, String pseudoPage) {
return new PageInfo(props, style, marginBoxes);
}

public List getFontFaceRules() {
public List<FontFaceRule> getFontFaceRules() {
return _fontFaceRules;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ protected List<AffineTransform> applyTranform(RenderingContext c, Box box) {
* We must apply the top/bottom margins from the previous pages, otherwise
* our transform center is wrong.
*/
for (int i = 0; i < c.getPageNo(); i++) {
for (int i = 0; i < c.getPageNo() && i < getPages().size(); i++) {
RectPropertySet prevMargin = getPages().get(i).getMargin(c);
relTranslateY += prevMargin.top() + prevMargin.bottom();
}
Expand Down
Loading

0 comments on commit 7813ee1

Please sign in to comment.