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

Compound/ZWJ-joined emoji #861

Open
si14 opened this issue Dec 16, 2024 · 3 comments
Open

Compound/ZWJ-joined emoji #861

si14 opened this issue Dec 16, 2024 · 3 comments
Labels

Comments

@si14
Copy link

si14 commented Dec 16, 2024

As far as I can tell, resvg doesn't render compound emojis:

Screenshot 2024-12-16 at 20 07 30

Am I doing something wrong, or is it indeed not implemented (yet, ever)?

Related: #735

@LaurenzV
Copy link
Contributor

I do think it should work, it looks more like resvg wasn't able to find a font with the emoji on your system. Could you maybe send the SVG so I can try it?

@si14
Copy link
Author

si14 commented Dec 16, 2024

<svg xmlns="http://www.w3.org/2000/svg" width="1500" height="600" viewBox="0 0 1500 600">
    <text x="50" y="550" text-anchor="start" dominant-baseline="text-after-edge"
          font-family="Nunito" fill="white"
          style="filter:drop-shadow(0 3px 7px black)">
        <tspan x="50" dy="-190" font-size="120px" font-weight="800">
            Every Time ✅
        </tspan>
        <tspan x="50" dy="113" font-size="66px" font-weight="800">12:25</tspan>
        <tspan x="50" dy="97" font-size="66px">London 🇬🇧</tspan>
    </text>
</svg>

Font DB is passed in explicitly and initialised like this:

        let mut fontdb = usvg::fontdb::Database::new();
        fontdb.load_font_data(
            include_bytes!("../fonts/apple_color_emoji/AppleColorEmoji.ttf").to_vec(),
        );
        fontdb.load_font_data(include_bytes!("../fonts/nunito/Nunito-Regular.ttf").to_vec());
        fontdb.load_font_data(include_bytes!("../fonts/nunito/Nunito-ExtraBold.ttf").to_vec());

The first font comes from this repackaged font which, as far as I can tell, does include flags: https://github.com/samuelngs/apple-emoji-linux

If it doesn't reproduce I'm happy to add you to the repo

@LaurenzV
Copy link
Contributor

Hmm yeah, can reproduce.

The following does indeed not work:
<tspan x="50" dy="97" font-size="66px">London 🇬🇧</tspan>
image

but if I change it to just containing the flag it works:
<tspan x="50" dy="97" font-size="66px"> 🇬🇧</tspan>
image

usvg's font fallback logic has unfortunately never been great, it's a hard problem.

@LaurenzV LaurenzV added the bug label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants