1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-06 18:30:52 +00:00
This commit is contained in:
Arnaud Roques 2021-12-02 18:39:20 +01:00
parent 2494e6a435
commit 50aef31027
19 changed files with 520 additions and 66 deletions

View File

@ -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 + "'");
//
// }
// }
// }
}

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -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<Atom> 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) {

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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<String, EmojiTwo> ALL = new HashMap<>();
static {
new EmojiTwo("2600");
new EmojiTwo("1f600", "smile");
new EmojiTwo("1f607", "innocent");
new EmojiTwo("1f60b", "yum");
}
private final List<String> 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("<path")) {
data.add(s);
} else if (s.contains("<g ")) {
data.add(s);
} else if (s.contains("<circle ")) {
data.add(s);
} else {
// System.err.println("???=" + s);
}
}
}
}
public void drawU(UGraphic ug, double scale) {
try {
loadIfNeed();
} catch (IOException e) {
e.printStackTrace();
}
for (String s : data) {
if (s.contains("<path")) {
// System.err.println("**path=" + s);
final HColor fill = extractFill(s);
if (fill != null)
ug = ug.apply(fill).apply(fill.bg());
final int x1 = s.indexOf("d=\"");
final int x2 = s.indexOf('"', x1 + 3);
final String tmp = s.substring(x1 + 3, x2);
// System.err.println("tmp=" + tmp);
final SvgPath svgPath = new SvgPath(tmp);
svgPath.drawMe(ug, scale);
} else if (s.contains("<g ")) {
// System.err.println("**g=" + s);
final HColor fill = extractFill(s);
if (fill != null)
ug = ug.apply(fill).apply(fill.bg());
} else if (s.contains("<circle ")) {
final double cx = Double.parseDouble(extractData("cx", s)) * scale;
final double cy = Double.parseDouble(extractData("cy", s)) * scale;
final double r = Double.parseDouble(extractData("r", s)) * scale;
final HColor fill = extractFill(s);
if (fill != null)
ug = ug.apply(fill).apply(fill.bg());
ug.apply(new UTranslate(cx - r, cy - r)).draw(new UEllipse(r * 2, r * 2));
} else {
// System.err.println("**?=" + s);
}
}
}
}

View File

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>grinning face</title>
<circle cx="32" cy="32" r="30" fill="#ffdd67"/>
<path fill="#664e27" d="M49.7 34.4c-.4-.5-1.1-.4-1.9-.4H16.2c-.8 0-1.5-.1-1.9.4C10.4 39.4 15 54 32 54s21.6-14.6 17.7-19.6"/>
<path fill="#4c3526" d="M33.8 41.7c-.6 0-1.5.5-1.1 2 .2.7 1.2 1.6 1.2 2.8 0 2.4-3.8 2.4-3.8 0 0-1.2 1-2 1.2-2.8.3-1.4-.6-2-1.1-2-1.6 0-4.1 1.7-4.1 4.6 0 3.2 2.7 5.8 6 5.8s6-2.6 6-5.8c-.1-2.8-2.7-4.5-4.3-4.6"/>
<path fill="#ff717f" d="M24.3 50.7c2.2 1 4.8 1.5 7.7 1.5 2.9 0 5.5-.6 7.7-1.5C37.6 49.6 35 49 32 49s-5.6.6-7.7 1.7"/>
<path fill="#fff" d="M47 36H17.1c-2.1 0-2.1 4-.1 4h30c2 0 2-4 0-4"/>
<g fill="#664e27">
<circle cx="20.5" cy="23" r="5"/>
<circle cx="43.5" cy="23" r="5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 806 B

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>smiling face with halo</title>
<path fill="#ffdd67" d="M61 33c0 16-13 29-29 29S3 49 3 33 16 4 32 4s29 13 29 29z"/>
<g fill="#664e27">
<path d="M28.6 34.4c-1.8-4.9-4.5-7.4-7.2-7.4s-5.4 2.5-7.2 7.4c-.2.5.7 1.4 1.2.9 1.7-1.8 3.8-2.6 6-2.6s4.3.7 6 2.6c.5.5 1.4-.4 1.2-.9M49.8 34.4C48 29.5 45.3 27 42.6 27s-5.4 2.5-7.2 7.4c-.2.5.7 1.4 1.2.9 1.7-1.8 3.8-2.6 6-2.6s4.3.7 6 2.6c.4.5 1.4-.4 1.2-.9M44.2 42.2c-7.8 5.5-16.5 5.4-24.3 0-.9-.7-1.8.5-1.1 1.5 2.4 3.9 7.2 7.4 13.3 7.4 6.1 0 10.9-3.5 13.3-7.4.5-1-.3-2.1-1.2-1.5"/>
</g>
<path fill="#4aa9ff" d="M54.3 7.2C53.8 3 45.9.8 28.5 2.6 12.2 4.4 3.9 8.3 4.3 12.4c.7 6.4 12.2 8.6 26 7.1 13.8-1.4 24.6-5.9 24-12.3m-24.7 5.4c-9.2 1-16.9.4-17-1.2-.1-.6.9-1.2 2.5-1.9C19.8 6.1 25.7 4 32 4c4.5 0 8.8 1 12.6 2.9.9.3 1.4.6 1.4 1 .2 1.5-7.2 3.7-16.4 4.7"/>
</svg>

After

Width:  |  Height:  |  Size: 890 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>face savoring food</title>
<path fill="#ffdd67" d="M62 32c0 16.6-13.4 30-30 30S2 48.6 2 32 15.4 2 32 2s30 13.4 30 30z"/>
<path fill="#ff717f" d="M42 47.9c-5-5-2.8-2.8 2.5-8.1s3.1-7.6 8.1-2.5c5 5 5.2 9.9 2.2 12.9-2.9 2.9-7.8 2.7-12.8-2.3"/>
<path fill="#e2596c" d="M45.6 38.7l6.8 9-8.9-6.8z"/>
<g fill="#664e27">
<path d="M28.5 24.9c-1.9-5.1-4.7-7.7-7.5-7.7s-5.6 2.6-7.5 7.7c-.2.5.8 1.4 1.3.9 1.8-1.9 4-2.7 6.2-2.7s4.4.8 6.2 2.7c.6.5 1.5-.4 1.3-.9M50.4 24.9c-1.9-5.1-4.7-7.7-7.5-7.7s-5.6 2.6-7.5 7.7c-.2.5.8 1.4 1.3.9 1.8-1.9 4-2.7 6.2-2.7s4.4.8 6.2 2.7c.5.5 1.5-.4 1.3-.9M48.1 33c-4.3 6.1-9.5 7.6-16.1 7.6S20.2 39.1 15.9 33c-.6-.8-2.2-.3-1.8.9 2.3 8 10 12.7 18 12.7s15.7-4.7 18-12.7c.2-1.2-1.4-1.7-2-.9"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 817 B

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<title>sun</title>
<path fill="#ffe62e" d="M20.5 59.7l7-7.2c-2.5-.5-4.8-1.5-6.9-2.9l-.1 10.1m23-55.4l-7 7.2c2.5.5 4.8 1.5 6.9 2.9l.1-10.1M4.3 43.5l10.1-.1C13 41.3 12 39 11.5 36.5l-7.2 7m55.4-23l-10.1.1c1.3 2.1 2.3 4.4 2.9 6.9l7.2-7m-55.4 0l7.2 7c.5-2.5 1.5-4.8 2.9-6.9l-10.1-.1m55.4 23l-7.2-7c-.5 2.5-1.5 4.8-2.9 6.9l10.1.1M20.5 4.3l.1 10.1c2.1-1.3 4.4-2.3 6.9-2.9l-7-7.2m23 55.4l-.1-10.1C41.3 51 39 52 36.5 52.5l7 7.2"/>
<g fill="#ffce31">
<path d="M14.8 44l-4 9.3 9.3-4C18 47.8 16.2 46 14.8 44m34.4-24l4-9.3-9.2 4c2 1.5 3.8 3.3 5.2 5.3m-37.8 8.3L2 32l9.4 3.7c-.3-1.2-.4-2.4-.4-3.7s.1-2.5.4-3.7m41.2 7.4L62 32l-9.4-3.7c.2 1.2.4 2.5.4 3.7 0 1.3-.1 2.5-.4 3.7M20 14.8l-9.3-4 4 9.3c1.5-2.1 3.3-3.9 5.3-5.3m24 34.4l9.3 4-4-9.3C47.8 46 46 47.8 44 49.2m-8.3-37.8L32 2l-3.7 9.4c1.2-.2 2.5-.4 3.7-.4s2.5.1 3.7.4m-7.4 41.2L32 62l3.7-9.4c-1.2.3-2.4.4-3.7.4s-2.5-.1-3.7-.4"/>
<circle cx="32" cy="32" r="19"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1003 B

View File

@ -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 {
}

View File

@ -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(" <b><size:16>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 + " : <font:" + n + ">" + text);

View File

@ -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 + "\\>";

View File

@ -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);
}

View File

@ -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':

View File

@ -127,14 +127,10 @@ public class SvgPath {
private List<SvgCommand> manageHV(List<SvgCommand> commands) {
final List<SvgCommand> result = new ArrayList<>();
SvgCommandNumber lastX = null;
SvgCommandNumber lastY = null;
final Iterator<SvgCommand> 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') {

View File

@ -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(" ");
}
}

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 0;
final int beta = 1;
return beta;
}