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

[Feature Request]: Emoji Support #41

Open
bhushan opened this issue Aug 21, 2021 · 4 comments
Open

[Feature Request]: Emoji Support #41

bhushan opened this issue Aug 21, 2021 · 4 comments

Comments

@bhushan
Copy link

bhushan commented Aug 21, 2021

Screenshot 2021-08-21 at 1 45 48 PM

Markdown supports Emojis, HTML Supports Emojis but In generated PDF, Emojis are shown incorrectly.

@themsaid Please have a look when you have time.

@plabbett
Copy link

plabbett commented Sep 7, 2021

I was able to get a little bit of emoji support working (enough for my pressing needs) using the following steps:

  1. Get the emoji fonts here: https://github.com/MorbZ/OpenSansEmoji
  2. Put the OpenSansEmoji.ttf file in the fonts directory as per the readme.md
  3. Edit the ibis.php file to include the new font

ibis.php:

/**
     * The list of fonts to be used in the different themes.
     */
    'fonts' => [
        //        'calibri' => 'Calibri-Regular.ttf',
        //        'times' => 'times-regular.ttf',
        'emoji' => 'OpenSansEmoji.ttf',
    ],
  1. Use the font in the theme file (theme-dark.html and/or theme-light.html)

theme-dark.html, theme-dark.html:

In the style section, add an emoji class:

.pdfEmoji{
      font-family: emoji;
    }
  1. In your markdown, use <span class="pdfEmoji">😎</span>

yourcontentfile.md:

<span class="pdfEmoji">😎</span>

The result looks like this:

image

There's a lot to desire - I presume a better emoji font would be the next starting point, but this served my needs for my pressing project. Hope it helps someone else in the meantime.

This also was useful in getting this to work: mpdf/mpdf#223

@bhushan
Copy link
Author

bhushan commented Sep 12, 2021

Thank you @plabbett its still not perfect will check it more.. thank you for idea

@shalvah
Copy link
Contributor

shalvah commented Oct 18, 2021

Thanks @plabbett this helped.

@Yinci
Copy link

Yinci commented Jan 26, 2024

I know this is an old thread, but I stumbled upon it regardless; consider users entering emojis into a textarea, meaning it will just be plain text. If I apply an emoji font, the "normal" characters won't display. I hoped a font-family with fallback would work (e.g. font-family: Helvetice, 'emoji', sans-serif) however that seems to not work within mPDF. Any suggestions?

(And yes I know this isn't the mPDF repo, however I got here via the mentioned 223 to begin with. I also realize the linked font is a merge font, however I'm struggling with more characters and I doubt it to be a good idea to try and mashup all required fonts into one ttf file, if it would even fit to begin with).

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

4 participants