diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java index ff32156ec..ab53b6c60 100644 --- a/src/net/sourceforge/plantuml/Run.java +++ b/src/net/sourceforge/plantuml/Run.java @@ -46,10 +46,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.net.URL; -import java.time.format.TextStyle; import java.util.ArrayList; import java.util.List; -import java.util.Locale; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -63,8 +61,8 @@ import net.sourceforge.plantuml.ftp.FtpServer; import net.sourceforge.plantuml.picoweb.PicoWebServer; import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.preproc.Stdlib; -import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SImageIO; import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.sprite.SpriteGrayLevel; import net.sourceforge.plantuml.sprite.SpriteUtils; @@ -85,10 +83,10 @@ public class Run { if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("-headless")) { System.setProperty("java.awt.headless", "true"); } - if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("--de")) { - debugGantt(); - return; - } +// if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("--de")) { +// debugGantt(); +// return; +// } saveCommandLine(argsArray); final Option option = new Option(argsArray); ProgressBar.setEnable(option.isTextProgressBar()); @@ -576,16 +574,16 @@ public class Run { error.goOk(); } - public static void debugGantt() { - final Locale locale = Locale.GERMAN; - for (java.time.Month month : java.time.Month.values()) { - System.err.println("Testing locale " + locale + " " + month); - for (TextStyle style : TextStyle.values()) { - final String s = month.getDisplayName(style, locale); - System.err.println(style + " --> '" + s + "'"); - - } - } - } +// public static void debugGantt() { +// final Locale locale = Locale.GERMAN; +// for (java.time.Month month : java.time.Month.values()) { +// System.err.println("Testing locale " + locale + " " + month); +// for (TextStyle style : TextStyle.values()) { +// final String s = month.getDisplayName(style, locale); +// System.err.println(style + " --> '" + s + "'"); +// +// } +// } +// } } diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java b/src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java new file mode 100644 index 000000000..a1224e631 --- /dev/null +++ b/src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java @@ -0,0 +1,70 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.creole.atom; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.emojitwo.EmojiTwo; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.UGraphic; + +public class AtomEmojiTwo extends AbstractAtom implements Atom { + + private static final double MAGIC = 4.0; + private final EmojiTwo emojiTwo; + private final double factor; + + public AtomEmojiTwo(EmojiTwo emojiTwo, double scale, FontConfiguration fontConfiguration) { + this.emojiTwo = emojiTwo; + this.factor = scale * fontConfiguration.getSize2D() / 12.0 / MAGIC; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + final double size = 64 * factor; + return new Dimension2DDouble(size, size); + } + + public double getStartingAltitude(StringBounder stringBounder) { + return -3 * factor; + } + + public void drawU(UGraphic ug) { + emojiTwo.drawU(ug, this.factor); + } + +} diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java new file mode 100644 index 000000000..f69b49751 --- /dev/null +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java @@ -0,0 +1,78 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.creole.command; + +import net.sourceforge.plantuml.command.regex.Matcher2; +import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; +import net.sourceforge.plantuml.graphic.Splitter; + +public class CommandCreoleEmojiTwo implements Command { + + @Override + public String startingChars() { + return "<"; + } + + private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.emojiTwoPattern + ")"); + + private CommandCreoleEmojiTwo() { + } + + public static Command create() { + return new CommandCreoleEmojiTwo(); + } + + public int matchingSize(String line) { + final Matcher2 m = pattern.matcher(line); + if (m.find() == false) + return 0; + + return m.group(1).length(); + } + + public String executeAndGetRemaining(String line, StripeSimple stripe) { + final Matcher2 m = pattern.matcher(line); + if (m.find() == false) + throw new IllegalStateException(); + + final String emoji = m.group(2); + stripe.addEmojiTwo(emoji); + return line.substring(m.group(1).length()); + } + +} diff --git a/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java b/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java index 02bde3bb9..4d82a5a46 100644 --- a/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java +++ b/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java @@ -89,10 +89,11 @@ public class AtomTextUtils { return createAtomText(url.getLabel(), url, fontConfiguration, skinSimple); } + private static final Pattern p = Pattern.compile(Splitter.openiconPattern + "|" + Splitter.spritePattern2 + "|" + + Splitter.imgPatternNoSrcColon + "|" + Splitter.emojiTwoPattern); + private static Atom createAtomText(final String text, Url url, FontConfiguration fontConfiguration, ISkinSimple skinSimple) { - final Pattern p = Pattern.compile( - Splitter.openiconPattern + "|" + Splitter.spritePattern2 + "|" + Splitter.imgPatternNoSrcColon); final Matcher m = p.matcher(text); final List result = new ArrayList<>(); while (m.find()) { @@ -104,6 +105,10 @@ public class AtomTextUtils { final String valOpenicon = m.group(1); final String valSprite = m.group(3); final String valImg = m.group(5); + final String valEmojiTwo = m.group(6); + if (valEmojiTwo != null) + throw new UnsupportedOperationException(); + if (valOpenicon != null) { final OpenIcon openIcon = OpenIcon.retrieve(valOpenicon); if (openIcon != null) { diff --git a/src/net/sourceforge/plantuml/creole/legacy/EmojiUnused.java b/src/net/sourceforge/plantuml/creole/legacy/EmojiUnused.java new file mode 100644 index 000000000..ada12dc76 --- /dev/null +++ b/src/net/sourceforge/plantuml/creole/legacy/EmojiUnused.java @@ -0,0 +1,91 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.creole.legacy; + +import java.util.regex.Pattern; + +// Syntax from https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md +// Unicode from https://unicode.org/emoji/charts/full-emoji-list.html + +public enum EmojiUnused { + + wave(0x1F44B), // + grinning(0x1F600), // + yum(0x1F60B), // + // smile(0x1F642), // + disappointed(0x2639), // + smile(0x263A), // + innocentfoo(0x1F607); // + + static private final Pattern ALL = allPattern(); + + private final int[] codePoints; + + private EmojiUnused(int... codePoints) { + this.codePoints = codePoints; + } + + private static Pattern allPattern() { + final StringBuilder result = new StringBuilder(); + result.append("\\<:("); + for (EmojiUnused emoji : EmojiUnused.values()) { + if (result.toString().endsWith("(") == false) + result.append("|"); + result.append(emoji.name()); + } + result.append("):\\>"); + return Pattern.compile(result.toString()); + } + + private String toJavaString() { + final StringBuilder result = new StringBuilder(); + + for (Integer codePoint : codePoints) + for (char ch : Character.toChars(codePoint)) + result.append(ch); + + return result.toString(); + } + + public static String replace(String s) { + if (ALL.matcher(s).find()) + for (EmojiUnused emoji : EmojiUnused.values()) + s = s.replace("<:" + emoji.name() + ":>", emoji.toJavaString()); + + return s; + } + +} diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java index 63369c205..11c20da91 100644 --- a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java +++ b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.creole.Stripe; import net.sourceforge.plantuml.creole.StripeStyle; import net.sourceforge.plantuml.creole.StripeStyleType; import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomEmojiTwo; import net.sourceforge.plantuml.creole.atom.AtomImg; import net.sourceforge.plantuml.creole.atom.AtomMath; import net.sourceforge.plantuml.creole.atom.AtomOpenIcon; @@ -60,6 +61,7 @@ import net.sourceforge.plantuml.creole.atom.AtomSprite; import net.sourceforge.plantuml.creole.command.Command; import net.sourceforge.plantuml.creole.command.CommandCreoleColorAndSizeChange; import net.sourceforge.plantuml.creole.command.CommandCreoleColorChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleEmojiTwo; import net.sourceforge.plantuml.creole.command.CommandCreoleExposantChange; import net.sourceforge.plantuml.creole.command.CommandCreoleFontFamilyChange; import net.sourceforge.plantuml.creole.command.CommandCreoleImg; @@ -74,6 +76,7 @@ import net.sourceforge.plantuml.creole.command.CommandCreoleSprite; import net.sourceforge.plantuml.creole.command.CommandCreoleStyle; import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange; import net.sourceforge.plantuml.creole.command.CommandCreoleUrl; +import net.sourceforge.plantuml.emojitwo.EmojiTwo; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; import net.sourceforge.plantuml.graphic.FontStyle; @@ -158,6 +161,7 @@ public class StripeSimple implements Stripe { addCommand(CommandCreoleImg.create()); addCommand(CommandCreoleQrcode.create()); addCommand(CommandCreoleOpenIcon.create()); + addCommand(CommandCreoleEmojiTwo.create()); addCommand(CommandCreoleMath.create()); addCommand(CommandCreoleLatex.create()); addCommand(CommandCreoleSprite.create()); @@ -251,16 +255,21 @@ public class StripeSimple implements Stripe { public void addSprite(String src, double scale, HColor color) { final Sprite sprite = skinParam.getSprite(src); - if (sprite != null) { + if (sprite != null) atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null)); - } } public void addOpenIcon(String src, double scale, HColor color) { final OpenIcon openIcon = OpenIcon.retrieve(src); - if (openIcon != null) { + if (openIcon != null) atoms.add(new AtomOpenIcon(color, scale, openIcon, fontConfiguration, null)); - } + } + + public void addEmojiTwo(String emoji) { + final EmojiTwo emojiTwo = EmojiTwo.retrieve(emoji); + if (emojiTwo != null) + atoms.add(new AtomEmojiTwo(emojiTwo, 1, fontConfiguration)); + } public void addMath(ScientificEquationSafe math) { diff --git a/src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java b/src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java new file mode 100644 index 000000000..a68be0642 --- /dev/null +++ b/src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java @@ -0,0 +1,141 @@ +package net.sourceforge.plantuml.emojitwo; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.emojitwo.data.Dummy; +import net.sourceforge.plantuml.openiconic.SvgPath; +import net.sourceforge.plantuml.ugraphic.UEllipse; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; + +// Shorcut from https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md +// Emojji from https://github.com/EmojiTwo/emojitwo +public class EmojiTwo { + + private final static Map ALL = new HashMap<>(); + + static { + new EmojiTwo("2600"); + new EmojiTwo("1f600", "smile"); + new EmojiTwo("1f607", "innocent"); + new EmojiTwo("1f60b", "yum"); + } + + private final List data = new ArrayList<>(); + private final String unicode; + + private EmojiTwo(String unicode) { + this(unicode, null); + } + + private EmojiTwo(String unicode, String shortcut) { + this.unicode = unicode; + ALL.put(unicode, this); + if (shortcut != null) + ALL.put(shortcut, this); + } + + public static String pattern() { + final StringBuilder sb = new StringBuilder("\\<:("); + for (String s : ALL.keySet()) { + if (sb.toString().endsWith("(") == false) + sb.append("|"); + sb.append(s); + } + sb.append("):\\>"); + return sb.toString(); + } + + public static EmojiTwo retrieve(String name) { + return ALL.get(name.toLowerCase()); + } + + private HColor extractFill(String s) { + final String col = extractData("fill", s); + if (col == null) + return null; + return HColorSet.instance().getColorOrWhite(col); + } + + private String extractData(String name, String s) { + final Pattern p = Pattern.compile(name + "=\"([^\"]+)\""); + final Matcher m = p.matcher(s); + if (m.find()) + return m.group(1); + + return null; + } + + private synchronized void loadIfNeed() throws IOException { + if (data.size() > 0) + return; + try (BufferedReader br = new BufferedReader( + new InputStreamReader(Dummy.class.getResourceAsStream(unicode + ".svg")))) { + String s = null; + while ((s = br.readLine()) != null) { + if (s.contains(" + grinning face + + + + + + + + + + \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/emojitwo/data/1f607.svg b/src/net/sourceforge/plantuml/emojitwo/data/1f607.svg new file mode 100644 index 000000000..81313f2ca --- /dev/null +++ b/src/net/sourceforge/plantuml/emojitwo/data/1f607.svg @@ -0,0 +1,8 @@ + + smiling face with halo + + + + + + \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/emojitwo/data/1f60b.svg b/src/net/sourceforge/plantuml/emojitwo/data/1f60b.svg new file mode 100644 index 000000000..3360f69c6 --- /dev/null +++ b/src/net/sourceforge/plantuml/emojitwo/data/1f60b.svg @@ -0,0 +1,9 @@ + + face savoring food + + + + + + + \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/emojitwo/data/2600.svg b/src/net/sourceforge/plantuml/emojitwo/data/2600.svg new file mode 100644 index 000000000..30ead9599 --- /dev/null +++ b/src/net/sourceforge/plantuml/emojitwo/data/2600.svg @@ -0,0 +1,8 @@ + + sun + + + + + + \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/emojitwo/data/Dummy.java b/src/net/sourceforge/plantuml/emojitwo/data/Dummy.java new file mode 100644 index 000000000..36f3fafe5 --- /dev/null +++ b/src/net/sourceforge/plantuml/emojitwo/data/Dummy.java @@ -0,0 +1,40 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.emojitwo.data; + +public class Dummy { + +} diff --git a/src/net/sourceforge/plantuml/font/PSystemListFonts.java b/src/net/sourceforge/plantuml/font/PSystemListFonts.java index 2bff51c14..3e4be24ad 100644 --- a/src/net/sourceforge/plantuml/font/PSystemListFonts.java +++ b/src/net/sourceforge/plantuml/font/PSystemListFonts.java @@ -41,20 +41,12 @@ import net.sourceforge.plantuml.PlainStringsDiagram; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.UmlSource; - public class PSystemListFonts extends PlainStringsDiagram { public PSystemListFonts(UmlSource source, String text) { super(source); strings.add(" Fonts available:"); strings.add(" "); - // final Font fonts[] = - // GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); - // for (Font f : fonts) { - // strings.add("f=" + f + "/" + f.getPSName() + "/" + f.getName() + "/" + - // f.getFontName() + "/" - // + f.getFamily()); - // } final String name[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for (String n : name) { strings.add(n + " : " + text); diff --git a/src/net/sourceforge/plantuml/graphic/Splitter.java b/src/net/sourceforge/plantuml/graphic/Splitter.java index 59b4a7439..6994ee5dc 100644 --- a/src/net/sourceforge/plantuml/graphic/Splitter.java +++ b/src/net/sourceforge/plantuml/graphic/Splitter.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.emojitwo.EmojiTwo; import net.sourceforge.plantuml.sprite.SpriteUtils; public class Splitter { @@ -71,6 +72,7 @@ public class Splitter { "\\}?" + // ")?"; + public static final String emojiTwoPattern = EmojiTwo.pattern(); public static final String openiconPattern = "\\<&([-\\w]+)" + scale + "\\>"; public static final String spritePattern2 = "\\<\\$(" + SpriteUtils.SPRITE_NAME + ")" + scale + "\\>"; diff --git a/src/net/sourceforge/plantuml/openiconic/Movement.java b/src/net/sourceforge/plantuml/openiconic/Movement.java index af412f3c4..6ee2dc6b5 100644 --- a/src/net/sourceforge/plantuml/openiconic/Movement.java +++ b/src/net/sourceforge/plantuml/openiconic/Movement.java @@ -85,8 +85,6 @@ public class Movement { throw new UnsupportedOperationException(); } if (mirrorControlPoint == null) { - // return this; - // throw new IllegalArgumentException(); return new Movement(new SvgCommandLetter("C"), this.getSvgPosition(0), this.getSvgPosition(0), lastPosition()); } @@ -117,47 +115,42 @@ public class Movement { return null; } return getSvgPosition(arguments.size() - 2); - // final SvgCommandNumber lastX = arguments.get(arguments.size() - 2); - // final SvgCommandNumber lastY = arguments.get(arguments.size() - 1); - // return new SvgPosition(lastX, lastY); } - // public SvgPosition firstPosition() { - // return getSvgPosition(0); - // // final SvgCommandNumber firstX = arguments.get(0); - // // final SvgCommandNumber firstY = arguments.get(1); - // // return new SvgPosition(firstX, firstY); - // } - public Movement toAbsoluteUpperCase(SvgPosition delta) { Objects.requireNonNull(delta); - if (letter.isUpperCase()) { + if (letter.is('H')) { + final SvgCommandNumber tmp = arguments.get(0); + return new Movement(new SvgCommandLetter("L"), new SvgPosition(tmp, delta.getY())); + } + if (letter.is('V')) + throw new UnsupportedOperationException(); + + if (letter.isUpperCase()) return this; - } - if (letter.is('m')) { + + if (letter.is('m')) return new Movement(new SvgCommandLetter("M"), delta.add(getSvgPosition(0))); - } - if (letter.is('l')) { + + if (letter.is('l')) return new Movement(new SvgCommandLetter("L"), delta.add(getSvgPosition(0))); - } - if (letter.is('z')) { + + if (letter.is('z')) return new Movement(new SvgCommandLetter("Z")); - } - if (letter.is('c')) { + + if (letter.is('c')) return new Movement(new SvgCommandLetter("C"), delta.add(getSvgPosition(0)), delta.add(getSvgPosition(2)), delta.add(getSvgPosition(4))); - } - if (letter.is('s')) { + + if (letter.is('s')) return new Movement(new SvgCommandLetter("S"), delta.add(getSvgPosition(0)), delta.add(getSvgPosition(2))); - } + if (letter.is('a')) { final SvgPosition last = delta.add(lastPosition()); // System.err.println("LAST=" + last); return new Movement(new SvgCommandLetter("A"), arguments.get(0), arguments.get(1), arguments.get(2), arguments.get(3), arguments.get(4), last.getX(), last.getY()); } - // A still to be done - // System.err.println("Movement::goUpperCase " + letter); throw new UnsupportedOperationException("Movement::goUpperCase " + letter); } diff --git a/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java b/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java index 49a9afcff..8c381e469 100644 --- a/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java +++ b/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java @@ -60,9 +60,10 @@ public class SvgCommandLetter implements SvgCommand { public int argumentNumber() { switch (StringUtils.goLowerCase(letter)) { case 'm': - case 'M': case 'l': return 2; + case 'h': + return 1; case 'z': return 0; case 'c': diff --git a/src/net/sourceforge/plantuml/openiconic/SvgPath.java b/src/net/sourceforge/plantuml/openiconic/SvgPath.java index 92fec33cb..2ad33e97d 100644 --- a/src/net/sourceforge/plantuml/openiconic/SvgPath.java +++ b/src/net/sourceforge/plantuml/openiconic/SvgPath.java @@ -127,14 +127,10 @@ public class SvgPath { private List manageHV(List commands) { final List result = new ArrayList<>(); - SvgCommandNumber lastX = null; - SvgCommandNumber lastY = null; final Iterator it = commands.iterator(); while (it.hasNext()) { final SvgCommand cmd = it.next(); if (cmd instanceof SvgCommandNumber) { - lastX = lastY; - lastY = (SvgCommandNumber) cmd; result.add(cmd); continue; } @@ -185,8 +181,8 @@ public class SvgPath { final SvgPosition ctl1 = move.getSvgPosition(0); final SvgPosition ctl2 = move.getSvgPosition(2); result.cubicTo(ctl1.getXDouble() * factor, ctl1.getYDouble() * factor, ctl2.getXDouble() * factor, - ctl2.getYDouble() * factor, lastPosition.getXDouble() * factor, lastPosition.getYDouble() - * factor); + ctl2.getYDouble() * factor, lastPosition.getXDouble() * factor, + lastPosition.getYDouble() * factor); } else if (letter == 'L') { result.lineTo(lastPosition.getXDouble() * factor, lastPosition.getYDouble() * factor); } else if (letter == 'A') { diff --git a/src/net/sourceforge/plantuml/version/License.java b/src/net/sourceforge/plantuml/version/License.java index cc5c8b91e..40ec75f53 100644 --- a/src/net/sourceforge/plantuml/version/License.java +++ b/src/net/sourceforge/plantuml/version/License.java @@ -530,6 +530,7 @@ public enum License { text.add("CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli"); text.add("Brotli (c) by the Brotli Authors https://github.com/google/brotli"); text.add("Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes"); + text.add("EmojiTwo SVG provided by https://github.com/EmojiTwo/emojitwo"); text.add(" "); } } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index c69d3aa38..2965c25a6 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 = 0; + final int beta = 1; return beta; }