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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji Support #16

Closed
styfle opened this issue Jan 22, 2019 · 14 comments
Closed

Emoji Support #16

styfle opened this issue Jan 22, 2019 · 14 comments

Comments

@styfle
Copy link

styfle commented Jan 22, 2019

Hello 馃憢 This is a really great tool you built! 馃槃

I found a related issue (#4) but the solution is to add a custom font in the .fonts directory.

Which font would I use to get emoji support? Have you had any success with rendering emoji? 馃

@j
Copy link

j commented Jan 24, 2019

Built-in support for this would be pretty awesome.

@alixaxel
Copy link
Owner

alixaxel commented Feb 9, 2019

@styfle I suppose Noto Emoji is what you need, specifically the Noto Color Emoji font.

I haven't had the need to use custom fonts yet, but if you try it, let me know how it goes. 馃槃


@j Even compressed, the TTF file is still over 7MB in size (no surprise there) and given that the main purpose of this package is to be as lightweight as possible, I'd rather delegate that choice to the end-user.

@alixaxel alixaxel closed this as completed Feb 9, 2019
@styfle
Copy link
Author

styfle commented Feb 11, 2019

@alixaxel That Noto Color Emoji font worked, thanks! 馃帀 馃帀 馃帀

If anyone is interested how to add this font, see these two pull requests (I missed a couple things on the first one 馃槈 )

vercel/og-image#52

vercel/og-image#54

(hint: adding to the .fonts directory is not enough)

@alixaxel
Copy link
Owner

@styfle Did you try adding the font under $HOME/.fonts/ and it didn't work?

@styfle
Copy link
Author

styfle commented Feb 11, 2019

@alixaxel No, I did not try that because that doesn鈥檛 work very nicely for local development (putting font files in the user鈥檚 home dir) and then deployment would require an additional build step to copy to the home dir.

@alixaxel
Copy link
Owner

alixaxel commented Mar 5, 2019

@styfle Not sure if you still need it, but I figured the newest addition might be interesting to you:

https://github.com/alixaxel/chrome-aws-lambda#fonts

@styfle
Copy link
Author

styfle commented Mar 5, 2019

@alixaxel Thanks for adding that method!

I'm currently reading the file as base64 and injecting into css font-face.

With this new function, how do you specify the name of the font-face so that it can be used in css classes below?

@alixaxel
Copy link
Owner

alixaxel commented Mar 5, 2019

@styfle Fonts have their font-face name encoded in the file itself (don't ask me specifics tho!).

image

@styfle
Copy link
Author

styfle commented Mar 5, 2019

@alixaxel Alright! I'll have to give this a try and see if it performs better than my css solution.

Does this only work with URLs or can I give it a relative path to the font file?

@alixaxel
Copy link
Owner

alixaxel commented Mar 5, 2019

Just URLs (and HTTPS ones).

@ed-sparkes
Copy link

@styfle did you ever try the chromium.font method? i cant seem to get it to work, sometimes it seems to run fine but the font is not reflected, other times i get a symlink err ERREXIST or something,

@vvo
Copy link

vvo commented Mar 8, 2021

For anyone still coming up here:

  • as for fonts support, I've had better success in building my page with @font-face than trying to use chromium.font(). Mainly because the font would not be loaded on the first load but on successive loads..
  • as for emoji support, the easiest is to build your page with https://github.com/twitter/twemoji

@clathrop
Copy link

@vvo Hey, I'm currently trying to get twemoji to load in a headless browser but as you mentioned, chromium.font() is not working with the ttf i've generated using the method here: https://github.com/mozilla/twemoji-colr.

For background, I've gotten the Noto Color Emoji to work but it is not widely supported for all emojis nor all PDF viewers.

So moving on to an @font-face & twemoji option like you suggested is my next bet. Question though, did you load the font face via cdn or load it from local file system in your build? Wondering exactly how you ended up setting up your solution. Thanks!

@vvo
Copy link

vvo commented Nov 4, 2021

(I have no idea sorry)

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

6 participants