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

Font-based icons didn't show #155

Closed
huanlin opened this issue Jan 9, 2018 · 8 comments
Closed

Font-based icons didn't show #155

huanlin opened this issue Jan 9, 2018 · 8 comments
Assignees

Comments

@huanlin
Copy link

huanlin commented Jan 9, 2018

Hi, font-based icons work in the generated PDF and HTML files, but not for EPUB files.
For example, in my asciidoc files, there are:

icon:commenting[size=2x]

This "commenting" icon is displayed correctly in the generated PDF and HTML file, but not in the EPUB file.
Looking into the content of EPUB file, I see the following tags in HTML:

<style scoped="scoped">
.i-commenting::before { content: ""; }
</style>

So I extract the HTML file and manually changed the empty value of content property, as below:

<style scoped="scoped">
.i-commenting::before { content: "\f27a"; }
</style>

Then I repack the EPUB file, and the icon displayed correctly now.
Am I missing something, or is this an known issue/design?

@gdamore
Copy link
Contributor

gdamore commented Jun 6, 2018

So I'm seeing a different problem, which is that with Kindle (using KDP publishing of the .mobi file) it looks like the font-based icons got dropped. They just render as squares, sort of like missing glyphs.

I'd like to be able to use images (SVGs) instead, because I think this will lead to a more uniform result across readers (not subject to users or readers choosing different font families) ... but I don't see an easy way to make that work with the -epub variant ... it looks like its kind of font-icons or nothing at all.

@mojavelinux
Copy link
Member

it looks like its kind of font-icons or nothing at all.

At the moment yes.

I'd like to be able to use images (SVGs) instead

Are we assuming Kindle supports SVGs? I can't remember the results of my research.

which is that with Kindle (using KDP publishing of the .mobi file) it looks like the font-based icons got dropped.

My understanding is that if you use KDP, the font-based icons are preserved as I documented in the README. However, given Amazon can rewrite the rules at anytime, I can't be 100% sure that my assumption is stable.

If you can figure out how to get SVG icons to work for admonitions, I'd be all for it. It's too much work for me to do right now.

@slonopotamus
Copy link
Contributor

Our real problem with icons is font_icon_map.rb. It is doomed to be outdated. We need a more robust way.

@mojavelinux
Copy link
Member

@slonopotamus you could make a script to generate it. That way CI could take care of it.

@slonopotamus
Copy link
Contributor

Have you considered including font-awesome css into epub? Possibly, stripped down to only include used icons.

And how does asciidoctor-pdf resolve icon name to a glyph? Does it know its Unicode symbol in the process? Maybe that could be reused.

@mojavelinux
Copy link
Member

Asciidoctor PDF also maintains a map (though it's handled by prawn-icon). See https://github.com/jessedoyle/prawn-icon/blob/master/data/fonts/fas/fas.yml That's were I got the idea from.

slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
slonopotamus added a commit to slonopotamus/asciidoctor-epub3 that referenced this issue Feb 4, 2020
@mklueh
Copy link

mklueh commented Jun 12, 2022

Some readers are not showing the icon at all, but highlighting the box in color, while others are just showing brackets instead of the icon. Haven't tested it with Kindle yet. Is this normal?

@slonopotamus
Copy link
Contributor

@mklueh would you mind creating a new issue? Preferrably, with an example document and info in what reader it doesn't work so others can reproduce (and, hopefully, fix) it?

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

No branches or pull requests

5 participants