From 5a4a1e902bf26d6f7db63846d35542ba112d9fcf Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 22 May 2020 08:31:42 +0100 Subject: [PATCH] WIP add stub WordWrapRequest --- .../net/kemitix/text/fit/WordWrapRequest.java | 16 ++++++++++++++++ .../java/net/kemitix/text/fit/WordWrapper.java | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/java/net/kemitix/text/fit/WordWrapRequest.java 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(); + } }