diff --git a/src/main/java/net/kemitix/text/fit/WordWrapRequest.java b/src/main/java/net/kemitix/text/fit/WordWrapRequest.java new file mode 100644 index 0000000..257d298 --- /dev/null +++ b/src/main/java/net/kemitix/text/fit/WordWrapRequest.java @@ -0,0 +1,16 @@ +package net.kemitix.text.fit; + +import lombok.Builder; +import lombok.With; + +import java.awt.*; + +@With +@Builder +public class WordWrapRequest { + String text; + Font font; + Graphics2D graphics2D; + int width; + +} diff --git a/src/main/java/net/kemitix/text/fit/WordWrapper.java b/src/main/java/net/kemitix/text/fit/WordWrapper.java index a4d2a09..646d590 100644 --- a/src/main/java/net/kemitix/text/fit/WordWrapper.java +++ b/src/main/java/net/kemitix/text/fit/WordWrapper.java @@ -1,6 +1,7 @@ package net.kemitix.text.fit; import java.awt.*; +import java.awt.geom.Rectangle2D; import java.util.List; public interface WordWrapper { @@ -10,4 +11,16 @@ public interface WordWrapper { Graphics2D graphics2D, int width ); + + default WordWrapRequest request( + String text, + Font font, + Graphics2D graphics2D + ) { + return WordWrapRequest.builder() + .text(text) + .font(font) + .graphics2D(graphics2D) + .build(); + } }