diff --git a/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java b/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java index f30c54e5..4548e9c3 100644 --- a/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java +++ b/src/main/java/stirling/software/SPDF/controller/web/GeneralWebController.java @@ -1,5 +1,12 @@ package stirling.software.SPDF.controller.web; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.stream.Collectors; + import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -65,8 +72,22 @@ public class GeneralWebController { @Hidden public String signForm(Model model) { model.addAttribute("currentPage", "sign"); + model.addAttribute("fonts", getFontNames()); return "sign"; } + private List getFontNames() { + try { + return Files.list(Paths.get("src/main/resources/static/fonts")) + .map(Path::getFileName) + .map(Path::toString) + .filter(name -> name.endsWith(".woff2")) + .map(name -> name.substring(0, name.length() - 6)) // Remove .woff2 extension + .collect(Collectors.toList()); + } catch (IOException e) { + throw new RuntimeException("Failed to read font directory", e); + } + } + @GetMapping("/crop") @Hidden diff --git a/src/main/resources/static/fonts/DancingScript-Regular.woff2 b/src/main/resources/static/fonts/DancingScript-Regular.woff2 new file mode 100644 index 00000000..17c598ae Binary files /dev/null and b/src/main/resources/static/fonts/DancingScript-Regular.woff2 differ diff --git a/src/main/resources/static/fonts/IndieFlower-Regular.woff2 b/src/main/resources/static/fonts/IndieFlower-Regular.woff2 new file mode 100644 index 00000000..f799fdd7 Binary files /dev/null and b/src/main/resources/static/fonts/IndieFlower-Regular.woff2 differ diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html index 667c3f99..bd072850 100644 --- a/src/main/resources/templates/sign.html +++ b/src/main/resources/templates/sign.html @@ -7,16 +7,20 @@ - + + + + +
@@ -169,9 +173,9 @@ + + +
@@ -196,20 +200,14 @@ DraggableUtils.createDraggableCanvasFromUrl(dataURL); } - + + + +