From d07aca44659b44a7ffcb08b464cf5db5b8258dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Wed, 9 Aug 2023 22:38:22 +0200 Subject: [PATCH] fix value to text renaming --- .../element/scripting/command/MarkupCommand.java | 6 +++--- .../layout/element/scripting/command/TextCommand.java | 6 +++--- .../src/test/resources/logging.properties | 10 ++++++++++ .../xbib/graphics/pdfbox/layout/test/scripting.json | 10 +++++----- 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 graphics-pdfbox-layout/src/test/resources/logging.properties diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MarkupCommand.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MarkupCommand.java index 750a865..3992346 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MarkupCommand.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/MarkupCommand.java @@ -19,11 +19,11 @@ public class MarkupCommand implements Command { @Override public void execute(Engine engine, State state, Settings settings) { - String value = settings.get("value"); - Document document = state.getDocument(); - TextElement textElement = new TextElement(true, value); + String text = settings.get("text"); + TextElement textElement = new TextElement(true, text); String[] fonts = settings.getAsArray("font"); float fontsize = settings.getAsFloat("fontsize", 10.0f); + Document document = state.getDocument(); for (String font : fonts) { textElement.addFont(document.getFont(font), fontsize); } diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TextCommand.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TextCommand.java index 94da52c..9145854 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TextCommand.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/TextCommand.java @@ -19,11 +19,11 @@ public class TextCommand implements Command { @Override public void execute(Engine engine, State state, Settings settings) { - String value = settings.get("value"); - Document document = state.getDocument(); - TextElement textElement = new TextElement(false, value); + String text = settings.get("text"); + TextElement textElement = new TextElement(false, text); String[] fonts = settings.getAsArray("font"); float fontsize = settings.getAsFloat("fontsize", 10.0f); + Document document = state.getDocument(); for (String font : fonts) { textElement.addFont(document.getFont(font), fontsize); } diff --git a/graphics-pdfbox-layout/src/test/resources/logging.properties b/graphics-pdfbox-layout/src/test/resources/logging.properties new file mode 100644 index 0000000..c51f7a4 --- /dev/null +++ b/graphics-pdfbox-layout/src/test/resources/logging.properties @@ -0,0 +1,10 @@ +handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler +.level=ALL +java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n +java.util.logging.ConsoleHandler.level=ALL +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.FileHandler.level=ALL +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.FileHandler.pattern=build/graphics.log +jdk.event.security.level=INFO +javax.management.level=INFO diff --git a/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json b/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json index 9662b21..883423c 100644 --- a/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json +++ b/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json @@ -64,7 +64,7 @@ "elements": [ { "type": "text", - "value": "Hello World 1", + "text": "Hello World 1", "fontsize": 24, "font": "helvetica" } @@ -75,7 +75,7 @@ "elements": [ { "type": "text", - "value": "Hello World 2", + "text": "Hello World 2", "fontsize": 24, "font": "helvetica" } @@ -86,7 +86,7 @@ "elements": [ { "type": "text", - "value": "Hello World 3", + "text": "Hello World 3", "fontsize": 24, "font": "helvetica" } @@ -101,7 +101,7 @@ "elements": [ { "type": "text", - "value": "Hello World 4", + "text": "Hello World 4", "fontsize": 16, "font": "notosans" } @@ -112,7 +112,7 @@ "elements": [ { "type": "text", - "value": "Hello World 5 Zwrotki dla Dorotki : arcyksiążę fiołków", + "text": "Hello World 5 Zwrotki dla Dorotki : arcyksiążę fiołków", "fontsize": 20, "font": "notosans" }