Skip to content

Commit

Permalink
Fix build on better_java2d branch.
Browse files Browse the repository at this point in the history
I should know by now not to resolve conflicts with the web interface.
  • Loading branch information
danfickle committed Mar 2, 2020
1 parent 55370bc commit 8fe65e6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@ public class AddedFont {
public final String family;
public final boolean subset;
public final FontStyle style;
public final Object pdfontSupplier; // Bit of a hack, not type-safe!

public AddedFont(FSSupplier<InputStream> supplier, File fontFile, Integer weight, String family, boolean subset,
FontStyle style) {
this.supplier = supplier;
this.fontFile = fontFile;
this.pdfontSupplier = null;
this.weight = weight;
this.family = family;
this.subset = subset;
this.style = style;
}

public AddedFont(Object pdfontSupplier, Integer weight, String family, boolean subset, FontStyle style) {
this.supplier = null;
this.fontFile = null;
this.pdfontSupplier = pdfontSupplier;
this.weight = weight;
this.family = family;
this.subset = subset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setText(String newText) {
* So we can test line breaking/justification with conditions more like real world.
*/
public static class CollapsedSpaceTextBreaker implements FSTextBreaker {
private final static Pattern SPACES = Pattern.compile("\\s");
private final static Pattern SPACES = Pattern.compile("[\\s\u00AD]");
private Matcher matcher;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public void testJustifySpaceAtEnd() throws IOException {
*/
@Test
public void testSoftHyphens() throws IOException {
assertTrue(vtester.runTest("soft-hyphens", WITH_COLLAPSED_LINE_BREAKER));
assertTrue(vtester.runTest("soft-hyphens", TestSupport.WITH_COLLAPSED_LINE_BREAKER));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public PdfBoxRenderer buildPdfRenderer() {
}
// use PDFont supplier
else if (font.pdfontSupplier != null) {
resolver.addFont(font.pdfontSupplier, font.family, font.weight, fontStyle, font.subset);
resolver.addFont((PDFontSupplier) font.pdfontSupplier, font.family, font.weight, fontStyle, font.subset);
}
// load via font File
else {
Expand Down Expand Up @@ -179,7 +179,7 @@ public PdfRendererBuilder usePDDocument(PDDocument doc) {
*/
public PdfRendererBuilder useFont(PDFontSupplier supplier, String fontFamily, Integer fontWeight,
FontStyle fontStyle, boolean subset) {
state._fonts.add(new AddedFont(null, supplier, null, fontWeight, fontFamily, subset, fontStyle));
state._fonts.add(new AddedFont(supplier, fontWeight, fontFamily, subset, fontStyle));
return this;
}

Expand Down

0 comments on commit 8fe65e6

Please sign in to comment.