fix font setup in document command
This commit is contained in:
parent
9eeebfac01
commit
ddb5db7b84
2 changed files with 10 additions and 13 deletions
|
@ -239,7 +239,6 @@ public class Document implements Element, Closeable, RenderListener {
|
||||||
return PDType0Font.load(pdDocument, openTypeFont, true);
|
return PDType0Font.load(pdDocument, openTypeFont, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Font getFont(String name) {
|
public Font getFont(String name) {
|
||||||
return fonts.get(name);
|
return fonts.get(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,18 +71,16 @@ public class DocumentCommand implements Command {
|
||||||
} else {
|
} else {
|
||||||
document.setModificationDate(instant);
|
document.setModificationDate(instant);
|
||||||
}
|
}
|
||||||
if (settings.containsSetting("font")) {
|
String[] fonts = settings.getAsArray("font");
|
||||||
String[] fonts = settings.getAsArray("font");
|
for (String font : fonts) {
|
||||||
for (String font : fonts) {
|
switch (font) {
|
||||||
switch (font) {
|
case "helvetica" -> document.registerFont("helvetica", BaseFont.HELVETICA);
|
||||||
case "helvetica" -> document.registerFont("helvetica", BaseFont.HELVETICA);
|
case "times" -> document.registerFont("times", BaseFont.TIMES);
|
||||||
case "times" -> document.registerFont("times", BaseFont.TIMES);
|
case "courier" -> document.registerFont("courier", BaseFont.COURIER);
|
||||||
case "courier" -> document.registerFont("courier", BaseFont.COURIER);
|
case "notosans" -> document.registerNotoSansFont();
|
||||||
case "notosans" -> document.registerNotoSansFont();
|
case "notosanscjksc" -> document.registerNotoSansCJKSCFont();
|
||||||
case "notosanscjksc" -> document.registerNotoSansCJKSCFont();
|
case "opensans" -> document.registerOpenSansFont();
|
||||||
case "opensans" -> document.registerOpenSansFont();
|
case "sourcesans" -> document.registerSourceSansFont();
|
||||||
case "sourcesans" -> document.registerSourceSansFont();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.getElements().push(document);
|
state.getElements().push(document);
|
||||||
|
|
Loading…
Reference in a new issue