diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2020-01-31 03:49:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-31 03:49:14 -0700 |
| commit | 8d05be2671832c37211dfbc657cebabe87e9d038 (patch) | |
| tree | 262bf0e5b3149a70af98d9e2a40b4e44b23b8c7a /scripts | |
| parent | ade075640a193616c6168285f49a2934f969a392 (diff) | |
resolves #1129 bundle emoji font and use as fallback font (PR #1527)
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/subset-fonts.pe | 43 | ||||
| -rwxr-xr-x | scripts/subset-fonts.sh | 9 |
2 files changed, 52 insertions, 0 deletions
diff --git a/scripts/subset-fonts.pe b/scripts/subset-fonts.pe index fc32868c..ccbeed77 100755 --- a/scripts/subset-fonts.pe +++ b/scripts/subset-fonts.pe @@ -40,6 +40,8 @@ genflags = 0x90 + 0x08 copy_fonts = ["NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-BoldItalic.ttf", "mplus-1p-regular.ttf"] copy_scripts = ["subset"] +emoji_fonts = ["NotoEmoji-Regular.ttf"] +emoji_scripts = ["subset"] code_fonts = ["mplus-1mn-light.ttf", "mplus-1mn-regular.ttf", "mplus-1mn-medium.ttf", "mplus-1mn-bold.ttf"] code_scripts = ["ascii", "subset"] @@ -312,6 +314,47 @@ while (fi < num_copy_fonts) endloop fi = 0 +num_emoji_fonts = SizeOf(emoji_fonts) +while (fi < num_emoji_fonts) + emoji_font = emoji_fonts[fi] + src_filepath = StrJoin([source_dir, emoji_font], "/") + new_basename = ToLower(emoji_font:r) + si = 0 + num_emoji_scripts = SizeOf(emoji_scripts) + while (si < num_emoji_scripts) + script = emoji_scripts[si] + new_filename = new_basename + "-" + script + ".ttf" + new_filepath = output_dir + "/" + new_filename + Open(src_filepath) + SelectAll() + # Remove TrueType instructions (i.e., hinting) + ClearInstrs() + SelectNone() + + SelectAll() + SelectFewer(0u00a0,0u21af) + SelectFewer(0u24c2) + SelectFewer(0u25a0,0u25ff) + SelectFewer(0u2611) + SelectFewer(0u26aa,0u26ab) + SelectFewer(0u2705) + SelectFewer(0u2714,0u2716) + SelectFewer(0u274c,0u2757) + SelectFewer(0u2790,0u1f25f) + SelectMore(0u2b50) + SelectInvert() + Clear() + SelectNone() + + Print("Generating " + new_filename + "...") + Generate(new_filepath, "", genflags) + Close() + si = si + 1 + endloop + fi = fi + 1 +endloop + +fi = 0 num_code_fonts = SizeOf(code_fonts) while (fi < num_code_fonts) code_font = code_fonts[fi] diff --git a/scripts/subset-fonts.sh b/scripts/subset-fonts.sh index 18089a95..6f3d2d5c 100755 --- a/scripts/subset-fonts.sh +++ b/scripts/subset-fonts.sh @@ -5,6 +5,7 @@ export SOURCE_DATE_EPOCH=$(date -d 2020-01-29T00:00:00 +%s) MPLUS_VERSION=TESTFLIGHT-063a NOTO_VERSION=86b2e553c3e3e4d6614dadd1fa0a7a6dafd74552 +EMOJI_VERSION=16151a2312a1f8a7d79e91789d3cfe24559d61f7 FONT_AWESOME_VERSION=4.7.0 SOURCE_DIR=fonts BUILD_DIR=../data/fonts @@ -29,6 +30,13 @@ if [ ! -d noto-$NOTO_VERSION ]; then cd .. fi +if [ ! -d emoji-$EMOJI_VERSION ]; then + mkdir emoji-$EMOJI_VERSION + cd emoji-$EMOJI_VERSION + curl -Ls -o NotoEmoji.ttf https://github.com/googlefonts/noto-emoji/raw/$EMOJI_VERSION/fonts/NotoEmoji-Regular.ttf + cd .. +fi + if [ ! -d font-awesome-$FONT_AWESOME_VERSION ]; then mkdir font-awesome-$FONT_AWESOME_VERSION cd font-awesome-$FONT_AWESOME_VERSION @@ -39,6 +47,7 @@ fi cp mplus-$MPLUS_VERSION/mplus-1mn*ttf . cp mplus-$MPLUS_VERSION/mplus-1p-regular.ttf . cp noto-$NOTO_VERSION/*.ttf . +cp emoji-$EMOJI_VERSION/*.ttf . cp font-awesome-$FONT_AWESOME_VERSION/*.ttf . cd .. |
