fix value to text renaming

This commit is contained in:
Jörg Prante 2023-08-09 22:38:22 +02:00
parent 8475f64388
commit d07aca4465
4 changed files with 21 additions and 11 deletions

View file

@ -19,11 +19,11 @@ public class MarkupCommand implements Command {
@Override @Override
public void execute(Engine engine, State state, Settings settings) { public void execute(Engine engine, State state, Settings settings) {
String value = settings.get("value"); String text = settings.get("text");
Document document = state.getDocument(); TextElement textElement = new TextElement(true, text);
TextElement textElement = new TextElement(true, value);
String[] fonts = settings.getAsArray("font"); String[] fonts = settings.getAsArray("font");
float fontsize = settings.getAsFloat("fontsize", 10.0f); float fontsize = settings.getAsFloat("fontsize", 10.0f);
Document document = state.getDocument();
for (String font : fonts) { for (String font : fonts) {
textElement.addFont(document.getFont(font), fontsize); textElement.addFont(document.getFont(font), fontsize);
} }

View file

@ -19,11 +19,11 @@ public class TextCommand implements Command {
@Override @Override
public void execute(Engine engine, State state, Settings settings) { public void execute(Engine engine, State state, Settings settings) {
String value = settings.get("value"); String text = settings.get("text");
Document document = state.getDocument(); TextElement textElement = new TextElement(false, text);
TextElement textElement = new TextElement(false, value);
String[] fonts = settings.getAsArray("font"); String[] fonts = settings.getAsArray("font");
float fontsize = settings.getAsFloat("fontsize", 10.0f); float fontsize = settings.getAsFloat("fontsize", 10.0f);
Document document = state.getDocument();
for (String font : fonts) { for (String font : fonts) {
textElement.addFont(document.getFont(font), fontsize); textElement.addFont(document.getFont(font), fontsize);
} }

View file

@ -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

View file

@ -64,7 +64,7 @@
"elements": [ "elements": [
{ {
"type": "text", "type": "text",
"value": "Hello World 1", "text": "Hello World 1",
"fontsize": 24, "fontsize": 24,
"font": "helvetica" "font": "helvetica"
} }
@ -75,7 +75,7 @@
"elements": [ "elements": [
{ {
"type": "text", "type": "text",
"value": "Hello World 2", "text": "Hello World 2",
"fontsize": 24, "fontsize": 24,
"font": "helvetica" "font": "helvetica"
} }
@ -86,7 +86,7 @@
"elements": [ "elements": [
{ {
"type": "text", "type": "text",
"value": "Hello World 3", "text": "Hello World 3",
"fontsize": 24, "fontsize": 24,
"font": "helvetica" "font": "helvetica"
} }
@ -101,7 +101,7 @@
"elements": [ "elements": [
{ {
"type": "text", "type": "text",
"value": "Hello World 4", "text": "Hello World 4",
"fontsize": 16, "fontsize": 16,
"font": "notosans" "font": "notosans"
} }
@ -112,7 +112,7 @@
"elements": [ "elements": [
{ {
"type": "text", "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, "fontsize": 20,
"font": "notosans" "font": "notosans"
} }