diff --git a/build.xml b/build.xml
index a0876c768..cb6ff16d7 100644
--- a/build.xml
+++ b/build.xml
@@ -36,8 +36,8 @@
-
-
+
+
diff --git a/pom.xml b/pom.xml
index ec6d50473..f3d2ed505 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,8 +145,8 @@
net/sourceforge/plantuml/version/*.png
net/sourceforge/plantuml/openiconic/data/*.txt
net/sourceforge/plantuml/openiconic/data/*.svg
- net/sourceforge/plantuml/emojitwo/data/*.svg
- net/sourceforge/plantuml/emojitwo/data/*.txt
+ net/sourceforge/plantuml/emoji/data/*.svg
+ net/sourceforge/plantuml/emoji/data/*.txt
net/sourceforge/plantuml/fun/*.png
sprites/archimate/*.png
net/sourceforge/plantuml/dedication/*.png
diff --git a/skin/plantuml.skin b/skin/plantuml.skin
index ccdb68f17..e9d8f6c50 100644
--- a/skin/plantuml.skin
+++ b/skin/plantuml.skin
@@ -90,6 +90,7 @@ sequenceDiagram {
lifeLine {
BackGroundColor white
+ LineStyle 5
}
}
diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java
index afa4cea36..c8ca7599b 100644
--- a/src/net/sourceforge/plantuml/PSystemBuilder.java
+++ b/src/net/sourceforge/plantuml/PSystemBuilder.java
@@ -65,7 +65,7 @@ import net.sourceforge.plantuml.eggs.PSystemEggFactory;
import net.sourceforge.plantuml.eggs.PSystemPathFactory;
import net.sourceforge.plantuml.eggs.PSystemRIPFactory;
import net.sourceforge.plantuml.eggs.PSystemWelcomeFactory;
-import net.sourceforge.plantuml.emojitwo.PSystemListEmojiFactory;
+import net.sourceforge.plantuml.emoji.PSystemListEmojiFactory;
import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.error.PSystemErrorUtils;
import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java b/src/net/sourceforge/plantuml/creole/atom/AtomEmoji.java
similarity index 83%
rename from src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java
rename to src/net/sourceforge/plantuml/creole/atom/AtomEmoji.java
index db39ff969..5748b042d 100644
--- a/src/net/sourceforge/plantuml/creole/atom/AtomEmojiTwo.java
+++ b/src/net/sourceforge/plantuml/creole/atom/AtomEmoji.java
@@ -38,26 +38,26 @@ 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.emoji.Emoji;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.HColor;
-public class AtomEmojiTwo extends AbstractAtom implements Atom {
+public class AtomEmoji extends AbstractAtom implements Atom {
- private static final double MAGIC = 40.0;
- private final EmojiTwo emojiTwo;
+ private static final double MAGIC = 24.0;
+ private final Emoji emoji;
private final double factor;
private final HColor color;
- public AtomEmojiTwo(EmojiTwo emojiTwo, double scale, double size2D, HColor color) {
- this.emojiTwo = emojiTwo;
+ public AtomEmoji(Emoji emoji, double scale, double size2D, HColor color) {
+ this.emoji = emoji;
this.factor = scale * size2D / MAGIC;
this.color = color;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
- final double size = 64 * factor;
+ final double size = 36 * factor;
return new Dimension2DDouble(size, size);
}
@@ -66,7 +66,7 @@ public class AtomEmojiTwo extends AbstractAtom implements Atom {
}
public void drawU(UGraphic ug) {
- emojiTwo.drawU(ug, this.factor, this.color);
+ emoji.drawU(ug, this.factor, this.color);
}
}
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmoji.java
similarity index 87%
rename from src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java
rename to src/net/sourceforge/plantuml/creole/command/CommandCreoleEmoji.java
index 24caebae9..0fa33a6d4 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmojiTwo.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleEmoji.java
@@ -41,20 +41,20 @@ 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 {
+public class CommandCreoleEmoji implements Command {
@Override
public String startingChars() {
return "<";
}
- private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.emojiTwoPattern + ")");
+ private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.emojiPattern + ")");
- private CommandCreoleEmojiTwo() {
+ private CommandCreoleEmoji() {
}
public static Command create() {
- return new CommandCreoleEmojiTwo();
+ return new CommandCreoleEmoji();
}
public int matchingSize(String line) {
@@ -70,9 +70,9 @@ public class CommandCreoleEmojiTwo implements Command {
if (m.find() == false)
throw new IllegalStateException();
- final boolean monochrome = m.group(2).equals(":") == false;
- final String emoji = m.group(4);
- stripe.addEmojiTwo(emoji, monochrome, m.group(3));
+ final String color = m.group(2);
+ final String emoji = m.group(3);
+ stripe.addEmoji(emoji, color);
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 e03bb99b6..b7ef85be2 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/AtomTextUtils.java
@@ -90,7 +90,7 @@ public class AtomTextUtils {
}
private static final Pattern p = Pattern.compile(Splitter.openiconPattern + "|" + Splitter.spritePattern2 + "|"
- + Splitter.imgPatternNoSrcColon + "|" + Splitter.emojiTwoPattern);
+ + Splitter.imgPatternNoSrcColon + "|" + Splitter.emojiPattern);
private static Atom createAtomText(final String text, Url url, FontConfiguration fontConfiguration,
ISkinSimple skinSimple) {
@@ -105,8 +105,8 @@ 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(7);
- if (valEmojiTwo != null)
+ final String valEmoji = m.group(7);
+ if (valEmoji != null)
throw new UnsupportedOperationException();
if (valOpenicon != null) {
diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
index 796cbde01..4c5077c8d 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java
@@ -52,7 +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.AtomEmoji;
import net.sourceforge.plantuml.creole.atom.AtomImg;
import net.sourceforge.plantuml.creole.atom.AtomMath;
import net.sourceforge.plantuml.creole.atom.AtomOpenIcon;
@@ -61,7 +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.CommandCreoleEmoji;
import net.sourceforge.plantuml.creole.command.CommandCreoleExposantChange;
import net.sourceforge.plantuml.creole.command.CommandCreoleFontFamilyChange;
import net.sourceforge.plantuml.creole.command.CommandCreoleImg;
@@ -76,7 +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.emoji.Emoji;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.FontPosition;
import net.sourceforge.plantuml.graphic.FontStyle;
@@ -96,7 +96,6 @@ public class StripeSimple implements Stripe {
final private List atoms = new ArrayList<>();
- // final private List commands = new ArrayList<>();
final private Map> commands = new HashMap<>();
private HorizontalAlignment align = HorizontalAlignment.LEFT;
@@ -138,9 +137,9 @@ public class StripeSimple implements Stripe {
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.PLAIN));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.PLAIN));
- if (modeSimpleLine == CreoleMode.FULL) {
+ if (modeSimpleLine == CreoleMode.FULL)
addCommand(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
- }
+
addCommand(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.UNDERLINE));
addCommand(CommandCreoleStyle.createCreole(FontStyle.STRIKE));
@@ -162,7 +161,7 @@ public class StripeSimple implements Stripe {
addCommand(CommandCreoleImg.create());
addCommand(CommandCreoleQrcode.create());
addCommand(CommandCreoleOpenIcon.create());
- addCommand(CommandCreoleEmojiTwo.create());
+ addCommand(CommandCreoleEmoji.create());
addCommand(CommandCreoleMath.create());
addCommand(CommandCreoleLatex.create());
addCommand(CommandCreoleSprite.create());
@@ -171,15 +170,14 @@ public class StripeSimple implements Stripe {
addCommand(CommandCreoleFontFamilyChange.createEol());
addCommand(CommandCreoleMonospaced.create());
addCommand(CommandCreoleUrl.create());
- if (SecurityUtils.allowSvgText()) {
+ if (SecurityUtils.allowSvgText())
addCommand(CommandCreoleSvgAttributeChange.create());
- }
this.header = style.getHeader(fontConfiguration, context);
- if (this.header != null) {
+ if (this.header != null)
this.atoms.add(this.header);
- }
+
}
private void addCommand(Command cmd) {
@@ -196,9 +194,9 @@ public class StripeSimple implements Stripe {
}
public List getAtoms() {
- if (atoms.size() == 0) {
+ if (atoms.size() == 0)
atoms.add(AtomTextUtils.createLegacy(" ", fontConfiguration));
- }
+
return Collections.unmodifiableList(atoms);
}
@@ -211,9 +209,9 @@ public class StripeSimple implements Stripe {
}
public void analyzeAndAdd(String line) {
- if (Objects.requireNonNull(line).contains("" + BackSlash.hiddenNewLine())) {
+ if (Objects.requireNonNull(line).contains("" + BackSlash.hiddenNewLine()))
throw new IllegalArgumentException(line);
- }
+
line = CharHidder.hide(line);
if (style.getType() == StripeStyleType.HEADING) {
fontConfiguration = fontConfigurationForHeading(fontConfiguration, style.getOrder());
@@ -226,16 +224,16 @@ public class StripeSimple implements Stripe {
}
private static FontConfiguration fontConfigurationForHeading(FontConfiguration fontConfiguration, int order) {
- if (order == 0) {
- fontConfiguration = fontConfiguration.bigger(4).bold();
- } else if (order == 1) {
- fontConfiguration = fontConfiguration.bigger(2).bold();
- } else if (order == 2) {
- fontConfiguration = fontConfiguration.bigger(1).bold();
- } else {
- fontConfiguration = fontConfiguration.italic();
+ switch (order) {
+ case 0:
+ return fontConfiguration.bigger(4).bold();
+ case 1:
+ return fontConfiguration.bigger(2).bold();
+ case 2:
+ return fontConfiguration.bigger(1).bold();
+ default:
+ return fontConfiguration.italic();
}
- return fontConfiguration;
}
public void addImage(String src, double scale) {
@@ -266,22 +264,24 @@ public class StripeSimple implements Stripe {
atoms.add(new AtomOpenIcon(color, scale, openIcon, fontConfiguration, null));
}
- public void addEmojiTwo(String emoji, boolean monochrome, String forcedColor) {
- final EmojiTwo emojiTwo = EmojiTwo.retrieve(emoji);
- if (emojiTwo != null) {
- HColor col = null;
- if (monochrome) {
- col = fontConfiguration.getColor();
- if (forcedColor != null)
- try {
- col = skinParam.getIHtmlColorSet().getColor(skinParam.getThemeStyle(), forcedColor);
- } catch (NoSuchColorException e) {
- }
+ public void addEmoji(String emojiName, String forcedColor) {
+ final Emoji emoji = Emoji.retrieve(emojiName);
+ if (emoji == null)
+ return;
+
+ HColor col = null;
+ if (forcedColor == null)
+ col = null;
+ else if (forcedColor.equals("#0") || forcedColor.equals("#000") || forcedColor.equals("#black"))
+ col = fontConfiguration.getColor();
+ else
+ try {
+ col = skinParam.getIHtmlColorSet().getColor(skinParam.getThemeStyle(), forcedColor);
+ } catch (NoSuchColorException e) {
+ col = null;
}
- atoms.add(new AtomEmojiTwo(emojiTwo, 1, fontConfiguration.getSize2D(), col));
- }
-
+ atoms.add(new AtomEmoji(emoji, 1, fontConfiguration.getSize2D(), col));
}
public void addMath(ScientificEquationSafe math) {
@@ -306,9 +306,9 @@ public class StripeSimple implements Stripe {
}
private void addPending(StringBuilder pending) {
- if (pending.length() == 0) {
+ if (pending.length() == 0)
return;
- }
+
atoms.add(AtomTextUtils.createLegacy(pending.toString(), fontConfiguration));
pending.setLength(0);
}
@@ -316,12 +316,10 @@ public class StripeSimple implements Stripe {
private Command searchCommand(String line) {
final List localList = commands.get(line.charAt(0));
if (localList != null)
- for (Command cmd : localList) {
- final int i = cmd.matchingSize(line);
- if (i != 0) {
+ for (Command cmd : localList)
+ if (cmd.matchingSize(line) != 0)
return cmd;
- }
- }
+
return null;
}
diff --git a/src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java b/src/net/sourceforge/plantuml/emoji/Emoji.java
similarity index 68%
rename from src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java
rename to src/net/sourceforge/plantuml/emoji/Emoji.java
index 1812072a2..567918259 100644
--- a/src/net/sourceforge/plantuml/emojitwo/EmojiTwo.java
+++ b/src/net/sourceforge/plantuml/emoji/Emoji.java
@@ -1,4 +1,4 @@
-package net.sourceforge.plantuml.emojitwo;
+package net.sourceforge.plantuml.emoji;
import java.io.BufferedReader;
import java.io.IOException;
@@ -13,12 +13,10 @@ import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import net.sourceforge.plantuml.emojitwo.data.Dummy;
+import net.sourceforge.plantuml.emoji.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.UPolygon;
-import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@@ -26,38 +24,38 @@ import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
-// Emojji from https://github.com/EmojiTwo/emojitwo
+// Emojji from https://twemoji.twitter.com/
// Shorcut from https://api.github.com/emojis
-public class EmojiTwo {
+public class Emoji {
- private final static Map ALL = new HashMap<>();
+ private final static Map ALL = new HashMap<>();
static {
- try (BufferedReader br = new BufferedReader(new InputStreamReader(getRessourceAllTxt()))) {
+ final InputStream tmp = getRessourceAllTxt();
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(tmp))) {
String s = null;
while ((s = br.readLine()) != null) {
- new EmojiTwo(s);
+ new Emoji(s);
}
} catch (IOException e) {
e.printStackTrace();
}
-
}
- public static Map getAll() {
+ public static Map getAll() {
return Collections.unmodifiableMap(new TreeMap<>(ALL));
}
static private InputStream getRessourceAllTxt() {
- return Dummy.class.getResourceAsStream("all.txt");
+ return Dummy.class.getResourceAsStream("emoji.txt");
}
private final List data = new ArrayList<>();
private final String unicode;
private final String shortcut;
- private EmojiTwo(String unicode) {
+ private Emoji(String unicode) {
final int x = unicode.indexOf(';');
if (x == -1) {
this.shortcut = null;
@@ -71,17 +69,17 @@ public class EmojiTwo {
}
public static String pattern() {
- final StringBuilder sb = new StringBuilder("\\<(:|(#\\w+)?\\.)(");
+ final StringBuilder sb = new StringBuilder("\\<(#\\w+)?:(");
for (String s : ALL.keySet()) {
if (sb.toString().endsWith("(") == false)
sb.append("|");
sb.append(s);
}
- sb.append(")[:.]\\>");
+ sb.append("):\\>");
return sb.toString();
}
- public static EmojiTwo retrieve(String name) {
+ public static Emoji retrieve(String name) {
return ALL.get(name.toLowerCase());
}
@@ -97,51 +95,24 @@ public class EmojiTwo {
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.startsWith("