Skip to content

Update to Twemoji 17.0.2 (Emoji 17.0)#74

Open
win98se wants to merge 5 commits intomozilla:masterfrom
win98se:patch-15
Open

Update to Twemoji 17.0.2 (Emoji 17.0)#74
win98se wants to merge 5 commits intomozilla:masterfrom
win98se:patch-15

Conversation

@win98se
Copy link
Copy Markdown
Contributor

@win98se win98se commented Feb 22, 2024

Will fix #73, #72, #69 & #68; Also includes workarounds for jdecked/twemoji@dbb2a10#commitcomment-124376242.

Notes:

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Mar 8, 2024

Caution: The fs.rm method is only compatible with Node.js version >=14. Recommended versions are >=16 (in Node.js versions 14 and 15, npm install throws a bunch of warnings and errors, although the make step runs fine).

@win98se win98se changed the title Update to Twemoji 15.0.3 (Emoji 15.0) Update to Twemoji 15.1.0 (Emoji 15.1) Mar 28, 2024
@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Mar 28, 2024

Twemoji 15.1.0 is out ~12 hours ago; Updated accordingly.

@Tricertops
Copy link
Copy Markdown

@win98se Hi, I’m wondering if you could help me with building the font on your branch. I’m getting this error without any indication of where it’s happening:

npm run grunt webfont

> twemoji-colr@0.7.0 grunt
> grunt webfont

Running "webfont:Twemoji" (webfont) task
Fatal error: CreateListFromArrayLike called on non-object
make: *** [build/raw-font/Twemoji Mozilla.ttf] Error 3

Is there an npm version mismatch or some dependency is broken there? Did you try running this recently?

@CoelacanthusHex
Copy link
Copy Markdown

@win98se Hi, I’m wondering if you could help me with building the font on your branch. I’m getting this error without any indication of where it’s happening:

npm run grunt webfont

> twemoji-colr@0.7.0 grunt
> grunt webfont

Running "webfont:Twemoji" (webfont) task
Fatal error: CreateListFromArrayLike called on non-object
make: *** [build/raw-font/Twemoji Mozilla.ttf] Error 3

Is there an npm version mismatch or some dependency is broken there? Did you try running this recently?

I met the same issue when packaging it in archlinuxcn.

@Nerixyz
Copy link
Copy Markdown

Nerixyz commented Jun 26, 2024

Works fine for me on Ubuntu 22.04 with Node 21 when running npm i && make.

@CoelacanthusHex
Copy link
Copy Markdown

Works fine for me on Ubuntu 22.04 with Node 21 when running npm i && make.

My nodejs version is 22.3.0 and npm version is 10.8.1. I'm on Arch Linux.

@CoelacanthusHex
Copy link
Copy Markdown

I see grunt-webfonts use fontforge, its version is 20230101-4.

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Jun 29, 2024

I have no problems building with Ubuntu 24.04, Node.js 22.3.0 and npm 10.8.1.

@Tricertops Please mention your build environment (such as operating system/distro, versions of Node.js and npm) as well.

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Jun 30, 2024

@CoelacanthusHex Please try to install the packages, fontforge and python-setuptools -
sudo pacman -S python-setuptools fontforge
Then retry building.

@Tricertops Please also try the above steps I've mentioned if you're also using Arch Linux.

@CoelacanthusHex
Copy link
Copy Markdown

@CoelacanthusHex Please try to install the packages, fontforge and python-setuptools - sudo pacman -S python-setuptools fontforge Then retry building.

Ok. python-setuptools is missing.

@Tricertops Please also try the above steps I've mentioned if you're also using Arch Linux.

@Tricertops
Copy link
Copy Markdown

@win98se Thanks! It seems like the package python-setuptools was missing for me as well!

I’m on macOS 14.5, node.js 22.3.0, npm 10.8.1, python 3.12.

However, I’m also facing another issue that I tried to fix, but didn’t find a way:

Traceback (most recent call last):
  File "[redacted]/TwemojiMozilla/fixDirection.py", line 1, in <module>
    import fontforge
ModuleNotFoundError: No module named 'fontforge'
make: *** [build/Twemoji Mozilla.ttf] Error 1

I definitely have fontforge package installed, but for some reason this script can’t locate it. When I skip the fixDirection.py step of the build, the rest of the make runs fine and I’m getting the TTF file on the expected location.

Do you have any ideas? I’m not really skilled in python 🤷🏻‍♂️

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Jul 2, 2024

I definitely have fontforge package installed, but for some reason this script can’t locate it.

Ah, it seems to be an environment problem. In your case, try to edit the Makefile file, with line 37 reading $(PYTHON) fixDirection.py $(RAW_FONT_TEMPORARY) changed to fontforge -lang=py -script fixDirection.py $(RAW_FONT_TEMPORARY) (replacing the term $(PYTHON) with fontforge -lang=py -script). Finally, rerun the make step.

@Tricertops
Copy link
Copy Markdown

@win98se That works, thank you very much!

@CoelacanthusHex
Copy link
Copy Markdown

Twemoji v16.0.1 was released around 3 months ago. Could you refresh this PR on 16.0.1?

https://github.com/jdecked/twemoji/releases/tag/v16.0.1

@win98se win98se changed the title Update to Twemoji 15.1.0 (Emoji 15.1) Update to Twemoji 16.0.1 (Emoji 16.0) Jul 1, 2025
@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Jul 1, 2025

Twemoji v16.0.1 was released around 3 months ago. Could you refresh this PR on 16.0.1?

Done, thank you for notifying. 👍

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 3, 2025

Twemoji 17.0.1 is out ~6.5 hours ago; Updated accordingly.

@win98se win98se changed the title Update to Twemoji 16.0.1 (Emoji 16.0) Update to Twemoji 17.0.1 (Emoji 17.0) Nov 3, 2025
@CoelacanthusHex
Copy link
Copy Markdown

CoelacanthusHex commented Nov 3, 2025

I met a build failure when try to build 17.0.1.

node layerize.js twe-svg.zip overrides extras build Twemoji\ Mozilla
overriding 1f1fa-1f1f3.svg with local copy
found mis-named 1f441-200d-1f5e8, renamed to 1f441-fe0f-200d-1f5e8-fe0f
node:events:497
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'id')
    at /home/coelacanthus/project/twemoji-colr/layerize.js:424:52
    at Array.forEach (<anonymous>)
    at /home/coelacanthus/project/twemoji-colr/layerize.js:420:29
    at Array.forEach (<anonymous>)
    at addToPaths (/home/coelacanthus/project/twemoji-colr/layerize.js:409:19)
    at /home/coelacanthus/project/twemoji-colr/layerize.js:557:9
    at Parser.<anonymous> (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:318:18)
    at Parser.emit (node:events:519:28)
    at SAXParser.onclosetag (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:276:26)
    at emit (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/sax@1.4.2/node_modules/sax/lib/sax.js:664:35)
    at emitNode (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/sax@1.4.2/node_modules/sax/lib/sax.js:669:5)
    at closeTag (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/sax@1.4.2/node_modules/sax/lib/sax.js:955:7)
    at SAXParser.write (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/sax@1.4.2/node_modules/sax/lib/sax.js:1548:13)
    at exports.Parser.Parser.parseString (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:337:31)
    at Parser.parseString (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:5:59)
    at processFile (/home/coelacanthus/project/twemoji-colr/layerize.js:402:12)
Emitted 'error' event on Parser instance at:
    at exports.Parser.Parser.parseString (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:341:16)
    at Parser.parseString (/home/coelacanthus/project/twemoji-colr/node_modules/.pnpm/xml2js@0.6.2/node_modules/xml2js/lib/parser.js:5:59)
    at processFile (/home/coelacanthus/project/twemoji-colr/layerize.js:402:12)
    at PassThrough.<anonymous> (/home/coelacanthus/project/twemoji-colr/layerize.js:756:21)
    at PassThrough.emit (node:events:531:35)
    at endReadableNT (node:internal/streams/readable:1698:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Node.js v22.21.0
make: *** [Makefile:44: build/codepoints.js] Error 1

It failed when parse 1f6d8.svg

@win98se win98se marked this pull request as draft November 3, 2025 17:43
@CoelacanthusHex
Copy link
Copy Markdown

If opt out 1f6d8.svg 1fa8e.svg 1facd.svg 1fac8.svg 1faea.svg, it will build success. it may be caused by those files use some feature which xml2js library doesn't support.

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 3, 2025

If opt out 1f6d8.svg 1fa8e.svg 1facd.svg 1fac8.svg 1faea.svg, it will build success. it may be caused by those files use some feature which xml2js library doesn't support.

Can confirm, thank you for your info. I think I have found the problems of these 5 SVGs (they're using styles instead of directly filling colors to paths), will try to find workarounds a.s.a.p..

@win98se win98se marked this pull request as ready for review November 3, 2025 18:25
@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 3, 2025

@CoelacanthusHex Please check whether my latest commit works.

@CoelacanthusHex
Copy link
Copy Markdown

@CoelacanthusHex Please check whether my latest commit works.

Yeah. It works!

@toshinou-kyoukoo
Copy link
Copy Markdown

Hello! If it's not a problem, could I have the built.ttf file? I can't figure out how to build it despite the instructions...

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 5, 2025

I can't figure out how to build it despite the instructions...

I have read your previous comment through e-mail, it seems you're using Microsoft Windows. In my opinion, it is extremely troublesome both installing and configuring Node.js, FontForge and fontTools on native Windows. I recommend you to use Windows Subsystem for Linux (WSL) instead; On Ubuntu (which is WSL's default distribution), the steps on README.md are already conclusive (you'll also need to install Node.js beforehand).

If it's not a problem, could I have the built.ttf file?

Sure, here it is; However it's safer to use an official release or your own generated font file.

@win98se win98se changed the title Update to Twemoji 17.0.1 (Emoji 17.0) Update to Twemoji 17.0.2 (Emoji 17.0) Nov 6, 2025
@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 6, 2025

Twemoji 17.0.2 is out ~8 hours ago; Updated accordingly and removed the 2025-11-04 workarounds.

@cachius
Copy link
Copy Markdown

cachius commented Nov 7, 2025

@mozilla @jfkthame Could you look into this? Would be nice to have an up to date version. Is there something blocking a new release lie the build system?

@AndroidDeveloperLB
Copy link
Copy Markdown

I want to use the twemoji font (TTF file, here) as it's super small (less than 2 MB!) compared to others, but sadly it has an issue with digits (here) and I fail to remove them via simple tools. Does it have any "fork"/update of it, that is still super small and just not having any issues?

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 28, 2025

I want to use the twemoji font (TTF file, here) as it's super small (less than 2 MB!) compared to others, but sadly it has an issue with digits (here) and I fail to remove them via simple tools. Does it have any "fork"/update of it, that is still super small and just not having any issues?

It seems that every emoji font that includes number emojis has this problem if you prioritize emoji fonts over normal text fonts (personally I don't think it's Twemoji-exclusive). The general practice is to specify all normal text fonts before emoji fonts, so that emoji fonts are only used for actual emojis and not snatching displays of number characters. In case you're using CSS, you may also specify the emoji font to only display for the full range of emojis.

@AndroidDeveloperLB
Copy link
Copy Markdown

AndroidDeveloperLB commented Nov 28, 2025

@win98se I think that if you view the glyphs of it, you will see that it is supposed to have the digits, but instead it has nothing.
I don't use CSS. I use Android. Currently I use a workaround that this font will not display digits, letting the OS/Framework use the system font be used for it.
But that's not a nice solution. Isn't there a nice updated version of this font (but still super small like here), or an easy way to modify it to remove the digits there for real?

@win98se
Copy link
Copy Markdown
Contributor Author

win98se commented Nov 28, 2025

@win98se I think that if you view the glyphs of it, you will see that it is supposed to have the digits, but instead it has nothing. I don't use CSS. I use Android. Currently I use a workaround that this font will not display digits, letting the OS/Framework use the system font be used for it. But that's not a nice solution. Isn't there a nice updated version of this font (but still super small like here), or an easy way to modify it to remove the digits there for real?

I've found a method to manually only include wanted glyph range when generating a subset of a font (in this case, Twemoji Mozilla):

# Source - https://stackoverflow.com/a/68066743
# Posted by Carson
# Retrieved 2025-11-29, License - CC BY-SA 4.0

import fontTools.subset
from pathlib import Path
import os

SOURCE_FILE = Path('Twemoji Mozilla.ttf')

def main():
	output_file = Path('temp') / Path(SOURCE_FILE.stem + '.ttf')
	output_file.parent.mkdir(parents=True, exist_ok=True)
	args = [SOURCE_FILE,
		f"--output-file={output_file}",
		"--unicodes=U+00A9-E007F",
		]
	fontTools.subset.main([str(_) for _ in args])
	os.startfile(output_file.parent)


if __name__ == "__main__":
	main()

In https://wakamaifondue.com/beta/, it will be shown that glyphs for #, * and 0-9 are removed. I have not tested this subset font extensively though; Your mileage may vary during usage.

Please try to generate your own Twemoji Mozilla and your desired subset of it, then test whether you're satisfied with the results.

@CoelacanthusHex
Copy link
Copy Markdown

@win98se I think that if you view the glyphs of it, you will see that it is supposed to have the digits, but instead it has nothing. I don't use CSS. I use Android. Currently I use a workaround that this font will not display digits, letting the OS/Framework use the system font be used for it. But that's not a nice solution. Isn't there a nice updated version of this font (but still super small like here), or an easy way to modify it to remove the digits there for real?

I've found a method to manually only include wanted glyph range when generating a subset of a font (in this case, Twemoji Mozilla):

# Source - https://stackoverflow.com/a/68066743
# Posted by Carson
# Retrieved 2025-11-29, License - CC BY-SA 4.0

import fontTools.subset
from pathlib import Path
import os

SOURCE_FILE = Path('Twemoji Mozilla.ttf')

def main():
	output_file = Path('temp') / Path(SOURCE_FILE.stem + '.ttf')
	output_file.parent.mkdir(parents=True, exist_ok=True)
	args = [SOURCE_FILE,
		f"--output-file={output_file}",
		"--unicodes=U+00A9-E007F",

fonttools only has the way to specify the character you want to keep, but for the case you want to give the chars you want to remove. I have a script to generate the complement set,

#!/usr/bin/python

# SPDX-FileCopyrightText: Coelacanthus
# SPDX-License-Identifier: MPL-2.0

import string
import itertools
import argparse
from typing import List, Iterable, Set, Tuple, Union

total_range: Set[int] = set(range(0x0, 0x10FFFF + 1))


def is_hex(s: str) -> bool:
    # all() return True for empty
    if not s:
        return False
    hex_digits = set(string.hexdigits)
    return all(c in hex_digits for c in s)


def ranges(i: Set[int]) -> Iterable[Union[Tuple[int, int], int]]:
    for a, b in itertools.groupby(enumerate(i), lambda pair: pair[1] - pair[0]):
        c: List[Tuple[int, int]] = list(b)
        if c[0][1] == c[-1][1]:
            yield c[0][1]
        else:
            yield c[0][1], c[-1][1]


def range_to_str(i: Union[Tuple[int, int], int]) -> str:
    match i:
        case (x, y):
            return "{:04X}-{:04X}".format(x, y)
        case x:
            return "{:04X}".format(x)


def read_ranges_from_file(file: str) -> Set[int]:
    result: Set[int] = set()
    with open(file, "r") as f:
        for line in f.readlines():
            li = line.strip()
            if not li.startswith("#"):
                if "-" in li:
                    a, b = li.split("-")
                    result.update(range(int(a, base=16), int(b, base=16) + 1))
                elif is_hex(li):
                    result.add(int(li, base=16))
    return result


def main() -> None:
    parser = argparse.ArgumentParser(
        prog="Complement",
        description="This program will generate complement set of two set, if input only one, will output the complement of 0x10FFFF",
    )
    parser.add_argument("--flat", action='store_true')
    parser.add_argument("filename1")
    parser.add_argument("filename2", nargs="?", default=None)
    args = parser.parse_args()
    if args.filename2:
        a: Set[int] = read_ranges_from_file(args.filename1)
        b: Set[int] = read_ranges_from_file(args.filename2)
    else:
        a: Set[int] = total_range
        b: Set[int] = read_ranges_from_file(args.filename1)
    out: Set[int] = sorted(a - b)
    if args.flat:
        print("\n".join(map(range_to_str, sorted(list(out)))))
    else:
        print("\n".join(map(range_to_str, ranges(out))))


if __name__ == "__main__":
    main()

And you can invoke fontTools.subset use fonttools subset cli directly.

		]
	fontTools.subset.main([str(_) for _ in args])
	os.startfile(output_file.parent)


if __name__ == "__main__":
	main()

In wakamaifondue.com/beta, it will be shown that glyphs for #, * and 0-9 are removed. I have not tested this subset font extensively though; Your mileage may vary during usage.

Please try to generate your own Twemoji Mozilla and your desired subset of it, then test whether you're satisfied with the results.

@AndroidDeveloperLB
Copy link
Copy Markdown

@CoelacanthusHex @win98se I'm sorry but I don't know what this all is that you wrote, and how to use it. Is it for some special tool that's for fonts, or on a website?

What is the website you've provided? It seems to be some kind of font viewer, but sadly doesn't seem to show all glyphs, and indeed it shows that for digits, the font file I've talked about (" ) shows (under "Number — Decimal Digit") as if it supports digits, but actually has them empty:

image

Why isn't there a decent UI based font editor nowadays, either on PC or online? One that shows properly all the glyphs, allows to edit, delete and add them to existing ones?
Fonts have exited for tens of years ... It's weird ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Twemoji 15 Update

7 participants