Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating from Noto Emoji #1

Open
evolucja opened this issue Jan 26, 2024 · 4 comments
Open

Generating from Noto Emoji #1

evolucja opened this issue Jan 26, 2024 · 4 comments

Comments

@evolucja
Copy link

evolucja commented Jan 26, 2024

Hello,
is there any way of generating a font directly from .svgs from the https://github.com/googlefonts/noto-emoji/tree/main/svg ?
It looks the naming is a little bit different and I don't know how to handle it.

Maybe anyone will find a few minutes and could have a look on that? Would appreciate.

PS this is very a good work and nicely described project!

Best regards
Dave

@360fun
Copy link

360fun commented Mar 2, 2024

I'm also interested! 😸

@gustavwilliam
Copy link
Owner

Thanks for the kind words @evolucja 😄

Yes, you can generate the font directly from .svgs! As for the name differences, you'll just have to find a way to convert them into Apple's format. I've tried to include everything you need to know in the README.md. It's quite a few files though, so I'd recommend figuring out how the naming pattern works/differs and then making a quick script to rename the files.

Hope this helps!

@360fun
Copy link

360fun commented Mar 3, 2024

I've renamed all the SVGs just removing emoji_u and give it a try to see how many emojis were missing. The script generated 1283 PNGs in 9 different size on 3577 total emojis.
I decided to build the font anyway, just expecting missing emojis.

Sadly I get errors which I don't think are connected to the missing pictures:

macmoji create font

Base emoji files already exist. Use `--force` to overwrite them.

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/cli/create.py", line 108, in _insert_emoji_runner
    successful, ignored = insert_all_emojis(assets_dir, ttx_in, ttx_out)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/inserter.py", line 119, in insert_all_emojis
    insert_emoji(strikes, name, size_paths)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/inserter.py", line 134, in insert_emoji
    raise ValueError(
ValueError: Invalid TTX file with no 'u1F1EA' `glyph` of size 20. Try regenerating base files by running `macmoji create base-files`.
Exception in thread Thread-6:
Traceback (most recent call last):
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/inserter.py", line 119, in insert_all_emojis
    insert_emoji(strikes, name, size_paths)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/inserter.py", line 134, in insert_emoji
    raise ValueError(
ValueError: Invalid TTX file with no 'u1F1EA' `glyph` of size 20. Try regenerating base files by running `macmoji create base-files`.
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/font.py", line 86, in generate_ttf_from_ttx
    ttx.ttCompile(
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/ttx.py", line 327, in ttCompile
    ttf.importXML(input)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/ttLib/ttFont.py", line 392, in importXML
    reader = xmlReader.XMLReader(fileOrPath, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/misc/xmlReader.py", line 26, in __init__
    self.file = open(fileOrPath, "rb")
                ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/USER/Library/Application Support/com.gustavwilliam.MacMoji/base-emoji-font/AppleColorEmoji-usr.ttx'
Exception in thread Thread-10:
Traceback (most recent call last):
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/font.py", line 86, in generate_ttf_from_ttx
    ttx.ttCompile(
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/ttx.py", line 327, in ttCompile
    ttf.importXML(input)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/ttLib/ttFont.py", line 392, in importXML
    reader = xmlReader.XMLReader(fileOrPath, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/fontTools/misc/xmlReader.py", line 26, in __init__
    self.file = open(fileOrPath, "rb")
                ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/USER/Library/Application Support/com.gustavwilliam.MacMoji/base-emoji-font/.AppleColorEmojiUI-usr.ttx'
Exception in thread Thread-12:
Traceback (most recent call last):
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/macmoji/font.py", line 97, in generate_ttc_from_ttf
    otf2otc.run(
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/afdko/otf2otc.py", line 260, in run
    tagOverrideMap, fileList, ttcFilePath = parseArgs(args)
                                            ^^^^^^^^^^^^^^^
  File "/Users/USER/.pyenv/versions/3.12.2/lib/python3.12/site-packages/afdko/otf2otc.py", line 170, in parseArgs
    raise OTCError("Cannot find '%s'." % (fontPath))
afdko.otf2otc.OTCError: Cannot find '/Users/USER/Library/Application Support/com.gustavwilliam.MacMoji/base-emoji-font/AppleColorEmoji-usr.ttf'.

The 9 PNG versions for the u1F1EA emoji are present. 🤔

@gustavwilliam
Copy link
Owner

gustavwilliam commented Mar 8, 2024

Strange. Have you tried running macmoji create base-files? Use the --force flag if it complains.

My guess for what's going on is that the program is having issues writing to ~/Library/Application Support (the place for storing application data for Mac apps). If this is the case, I don't have a solution right off the bat.

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

No branches or pull requests

3 participants