Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion unicodetools/src/main/java/org/unicode/tools/emoji/Emoji.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,49 @@
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.VersionInfo;

/**
* You need a command line variable to generate either the beta version (not yet released) or the abbreviated version (see below).
* <p>Example: -Demoji-beta
Comment on lines +44 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The emoji-beta option is already mentioned on https://github.com/unicode-org/unicodetools/blob/main/docs/emoji/index.md
Wouldn't it be better to update that and point from here to there?

Note that there are several docs pages under emoji/ : https://github.com/unicode-org/unicodetools/tree/main/docs/emoji

* <p>With each new version, set
* <ul><li> VERSION_LAST_RELEASED2 = VERSIONxx;</li>
* <li>VERSION_LAST_RELEASED = VERSIONyy;</li>
* <li>VERSION_BETA = VERSIONzz;</li></ul>
* You also need to add 2 new constants, such as:
* <ul><li> VERSION15;</li>
* <li>UCD15;</li></ul>
* And add dates to the following:
* <ul><li> EMOJI_TO_UNICODE_VERSION</li>
* <li>EMOJI_TO_DATE</li></ul>
* <p>And add the images to the images repository.
* <p>Charts will be generated in folders that depend on Settings.Output.GEN_DIR, such as:
*<pre>…Generated/unicodetools/emoji/
future/
emoji-candidates.html
emoji-candidates.txt
emoji-list.css
emoji-provisional.html
emoji-provisional.txt
index.html
charts-15.0/
emoji-counts-details.tsv
emoji-counts.html
emoji-counts.tsv
emoji-list.css
emoji-list.html
emoji-list.txt
internal/ # used for cross checking
missing-emoji-list.html # check that available vendor images are present (tsv version also)
</pre>
*/
public class Emoji {

/**
* The following is used to generate an abbreviated version of the charts, where only a few rows are produced,
* and all images are replaced by a colored square (small data size).
* This version can be used to do link-checks.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set your editor to write spaces, not tabs, and fix this comment.

static final boolean ABBR = CldrUtility.getProperty("emoji-abbr", false);
//static final boolean EMOJI_BUILD_VERSION = CldrUtility.getProperty("emoji-version", false);

Expand All @@ -62,6 +103,7 @@ public class Emoji {
/**
* Constants for versions
*/
public static final VersionInfo VERSION15 = VersionInfo.getInstance(15,0);
public static final VersionInfo VERSION14 = VersionInfo.getInstance(14,0);
public static final VersionInfo VERSION13_1 = VersionInfo.getInstance(13,1);
public static final VersionInfo VERSION13 = VersionInfo.getInstance(13);
Expand All @@ -78,6 +120,7 @@ public class Emoji {
public static final VersionInfo VERSION0_5 = VersionInfo.getInstance(0,5,2);

// ALSO fix VersionToAge.java!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant?

public static final VersionInfo UCD15 = VERSION15;
public static final VersionInfo UCD14 = VERSION14;
public static final VersionInfo UCD13 = VERSION13;
public static final VersionInfo UCD12_1 = VERSION12_1;
Expand All @@ -95,12 +138,13 @@ public class Emoji {
*/
public static final VersionInfo VERSION_LAST_RELEASED2 = VERSION13_1;
public static final VersionInfo VERSION_LAST_RELEASED = VERSION14;
public static final VersionInfo VERSION_BETA = VERSION14;
public static final VersionInfo VERSION_BETA = VERSION15;

public static final VersionInfo VERSION_TO_TEST = VERSION_BETA;
public static final VersionInfo VERSION_TO_TEST_PREVIOUS = VERSION_LAST_RELEASED;

public static Map<VersionInfo, VersionInfo> EMOJI_TO_UNICODE_VERSION = ImmutableMap.<VersionInfo, VersionInfo>builder()
.put(VERSION15, UCD15)
.put(VERSION14, UCD14)
.put(VERSION13_1, UCD13)
.put(VERSION13, UCD13)
Expand All @@ -117,6 +161,7 @@ public class Emoji {
.build();

public final static Map<VersionInfo, String> EMOJI_TO_DATE = ImmutableMap.<VersionInfo, String>builder()
.put(VERSION15, "2022-09-10")
.put(VERSION14, "2021-09-10")
.put(VERSION13_1, "2020-09-10")
.put(VERSION13, "2020-03-10")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static String getDataUrlFromFilename(Source source, String filename) {
} else {
byte[] bytes = GenerateEmoji.RESIZE_IMAGE <= 0 ? Files.readAllBytes(file.toPath())
: LoadImage.resizeImage(file, GenerateEmoji.RESIZE_IMAGE, GenerateEmoji.RESIZE_IMAGE);
result = "data:image/png;base64," + Base64.getEncoder().encode(bytes);
result = "data:image/png;base64," + Base64.getEncoder().encodeToString(bytes);
}
EmojiImageData.IMAGE_CACHE.put(filename, result);
}
Expand Down