Skip to content

Commit

Permalink
bump version 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
firm1 committed Jun 14, 2017
1 parent d2fbf17 commit 3aa3c62
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.7.1
version=1.8.0
javafx.releaseKey.keyPass=clementine
javafx.releaseKey.storePass=clementine
javafx.releaseKey.keyStore = keys/keystore.jks
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
import java.util.function.Function;

@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type", visible=true)
@JsonSubTypes({@Type(value = Container.class, name = "null"), @Type(value = Content.class, name = "TUTORIAL"), @Type(value = Content.class, name = "ARTICLE"), @Type(value = Content.class, name = "OPINION") })
@JsonSubTypes({
@Type(value = Container.class, name = "null"),
@Type(value = Content.class, name = "TUTORIAL"),
@Type(value = Content.class, name = "ARTICLE"),
@Type(value = Content.class, name = "OPINION") })
public class Container extends MetaContent implements ContentNode {
private Textual _introduction;
private Textual _conclusion;
Expand Down
27 changes: 13 additions & 14 deletions src/main/java/com/zestedesavoir/zestwriter/utils/PdfUtilExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,16 @@ public class PdfUtilExport {
private final static int FONT_SIZE_TITLE = 20;
private final static int FONT_SIZE_AUTHOR = 12;
private static PDFont FONT_STYLE_COVER;
private static File FONT_MERRIWEATHER_REGULAR;
private static File FONT_MERRIWEATHER_BOLD;
private static File FONT_MERRIWEATHER_ITALIC;
private static File FONT_SOURCE_CODE_PRO;
private static final String FONT_MERRIWEATHER_REGULAR="assets/static/fonts/Merriweather-Regular.ttf";
private static final String FONT_MERRIWEATHER_BOLD="assets/static/fonts/Merriweather-Bold.ttf";
private static final String FONT_MERRIWEATHER_ITALIC="assets/static/fonts/Merriweather-Italic.ttf";
private static final String FONT_SOURCE_CODE_PRO="assets/static/fonts/SourceCodePro-Regular.ttf";

public PdfUtilExport(String titleContent, String authorContent, String srcHtmlPath, String destPdfPath) {
this.titleContent = titleContent.toUpperCase();
this.authorContent = authorContent;
this.srcHtmlPath = srcHtmlPath;
this.destPdfPath = destPdfPath;

FONT_MERRIWEATHER_REGULAR = new File(MainApp.class.getResource("assets/static/fonts/Merriweather-Regular.ttf").getFile());
FONT_MERRIWEATHER_BOLD = new File(MainApp.class.getResource("assets/static/fonts/Merriweather-Bold.ttf").getFile());
FONT_MERRIWEATHER_ITALIC = new File(MainApp.class.getResource("assets/static/fonts/Merriweather-Italic.ttf").getFile());
FONT_SOURCE_CODE_PRO = new File(MainApp.class.getResource("assets/static/fonts/SourceCodePro-Regular.ttf").getFile());
XRLog.setLoggingEnabled(false);
}

Expand Down Expand Up @@ -83,7 +78,7 @@ private void addCoverpage() throws IOException {
PDDocument document = new PDDocument();
PDPage page = new PDPage();
document.addPage(page);
FONT_STYLE_COVER = PDTrueTypeFont.loadTTF(document, FONT_MERRIWEATHER_BOLD);
FONT_STYLE_COVER = PDTrueTypeFont.loadTTF(document, MainApp.class.getResourceAsStream(FONT_MERRIWEATHER_BOLD));
PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.setNonStrokingColor(25, 81, 107);
contentStream.fillRect(0, 0, page.getMediaBox().getWidth(), (page.getMediaBox().getHeight() / 2) - 10);
Expand Down Expand Up @@ -125,10 +120,14 @@ public boolean exportToPdf() {

builder.withUri(destPdfPath);
builder.toStream(os);
builder.useFont(FONT_MERRIWEATHER_REGULAR,"Merriweather",400, PdfRendererBuilder.FontStyle.NORMAL,true);
builder.useFont(FONT_MERRIWEATHER_ITALIC,"Merriweather", 400, PdfRendererBuilder.FontStyle.ITALIC,true);
builder.useFont(FONT_MERRIWEATHER_BOLD,"Merriweather", 700, PdfRendererBuilder.FontStyle.NORMAL, true);
builder.useFont(FONT_SOURCE_CODE_PRO,"Source Code Pro");
builder.useFont(new File(MainApp.class.getResource(FONT_MERRIWEATHER_REGULAR).getFile()),
"Merriweather",400, PdfRendererBuilder.FontStyle.NORMAL,true);
builder.useFont(new File(MainApp.class.getResource(FONT_MERRIWEATHER_ITALIC).getFile()),
"Merriweather", 400, PdfRendererBuilder.FontStyle.ITALIC,true);
builder.useFont(new File(MainApp.class.getResource(FONT_MERRIWEATHER_BOLD).getFile()),
"Merriweather", 700, PdfRendererBuilder.FontStyle.NORMAL, true);
builder.useFont(new File(MainApp.class.getResource(FONT_SOURCE_CODE_PRO).getFile()),
"Source Code Pro");
builder.withW3cDocument(html5ParseDocument(srcHtmlPath, 1000), srcHtmlPath);
builder.useHttpStreamImplementation(new OkHttpStreamFactory());
builder.run();
Expand Down

0 comments on commit 3aa3c62

Please sign in to comment.