Skip to content

Commit

Permalink
Merge pull request #213 from metanorma/fontist_debug
Browse files Browse the repository at this point in the history
fontist manifest file saving in debug mode, #212
  • Loading branch information
Intelligent2013 authored Jun 16, 2023
2 parents f3da485 + 41c1391 commit 4127d30
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/metanorma/fop/PDFGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ public boolean process() {
fontcfg.setFontConfigPath(fPDF.getAbsolutePath());

fontcfg.setFontManifest(fFontsManifest);

fontcfg.saveFontManifest(fPDF.getParent()); // for debug purposes

//debug
fontcfg.outputFontManifestLog(Paths.get(fPDF.getAbsolutePath() + ".fontmanifest.log.txt"));

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/metanorma/fop/fontConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -318,6 +319,20 @@ public void outputFontManifestLog(Path logPath) {
logger.log(Level.INFO, "Font manifest reading log saved to ''{0}''.", logPath);
}
}

public void saveFontManifest(String manifestPath) {
if(DEBUG) {
if (fFontManifest != null) {
try {
Path outPath = Paths.get(manifestPath, fFontManifest.getName());
Files.copy(Paths.get(fFontManifest.getAbsolutePath()), outPath, StandardCopyOption.REPLACE_EXISTING);
logger.log(Level.INFO, "Fontist manifest file saved to ''{0}''.", outPath.toFile().getAbsolutePath());
} catch (IOException ex) {
logger.log(Level.WARNING, "Can''t copy fontist manifest file saved to ''{0}''.", manifestPath);
}
}
}
}

public Map<String,String> getFontStyles(String style) {
Map<String,String> fontstyle = new HashMap<>();
Expand Down

0 comments on commit 4127d30

Please sign in to comment.