From 9ee6179c3a81a451c4ed3e3f78cf0de7d32ab712 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Wed, 10 Nov 2021 22:15:26 +0100 Subject: [PATCH] Improve hyperlink color management --- .../plantuml/graphic/FontConfiguration.java | 13 ++++++++----- .../plantuml/svek/image/EntityImageNote.java | 15 ++++++++++----- src/net/sourceforge/plantuml/version/Version.java | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index 0b692d27e..860b4939a 100644 --- a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java +++ b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java @@ -103,9 +103,9 @@ public class FontConfiguration { return useUnderlineForHyperlink; } - public final HColor getHyperlinkColor() { - return hyperlinkColor; - } +// public final HColor getHyperlinkColor() { +// return hyperlinkColor; +// } // --- @@ -170,8 +170,11 @@ public class FontConfiguration { fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink, tabSize); } - public FontConfiguration changeColor(HColor htmlColor) { - return new FontConfiguration(styles, motherFont, motherColor, currentFont, htmlColor, extendedColor, + public FontConfiguration changeColor(HColor newHtmlColor) { + if (hyperlink) + return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor, + fontPosition, svgAttributes, hyperlink, newHtmlColor, useUnderlineForHyperlink, tabSize); + return new FontConfiguration(styles, motherFont, motherColor, currentFont, newHtmlColor, extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 3514006fd..91c066739 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -106,6 +106,8 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final Rose rose = new Rose(); + final FontConfiguration fontConfiguration; + final HorizontalAlignment horizontalAlignment; if (UseStyle.useBetaStyle()) { final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName()) .getMergedStyle(skinParam.getCurrentStyleBuilder()); @@ -118,6 +120,9 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); this.shadowing = style.value(PName.Shadowing).asDouble(); + + fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + horizontalAlignment = style.getHorizontalAlignment(); } else { this.shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) { @@ -126,16 +131,16 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { this.noteBackgroundColor = entity.getColors(getSkinParam()).getColor(ColorType.BACK); } this.borderColor = SkinParamUtils.getColor(getSkinParam(), null, ColorParam.noteBorder); + + fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.NOTE, null); + horizontalAlignment = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false, null); } if (strings.size() == 1 && strings.get(0).length() == 0) { textBlock = new TextBlockEmpty(); } else { - final FontConfiguration fc = new FontConfiguration(getSkinParam(), FontParam.NOTE, null); - final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, - false, null); - textBlock = BodyFactory.create3(strings, FontParam.NOTE, getSkinParam(), align, fc, - getSkinParam().wrapWidth()); + textBlock = BodyFactory.create3(strings, FontParam.NOTE, getSkinParam(), horizontalAlignment, + fontConfiguration, getSkinParam().wrapWidth()); } } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index b2e7617d1..f3f8a25ed 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 5; + final int beta = 6; return beta; }