![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jul 2021
Device: Kobo Aura One, Kindle android
|
How to refer to stylesheet (font-face) from svg?
In my source .azw3 file, there are some svg files starting with header `<?xml-stylesheet href="../styles/0001.css" type="text/css" ?>`. But after conversion to epub/mobi, this header is removed in the output. Is that invalid xml which only kindle supports?
Usecase - Inside `0001.css`, it uses a special font-face for svg text tags using `text {font-family: "Diagram";}` and embeds that font. So, effectively that svg (chess diagram) is rendered properly with this Diagram font. Is there some way to do this in epub/mobi? In short, I want to change font-face for text elements within svg. (I can share these css, svg files if required but attaching those formats directly isn't allowed in the posts) |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yeah it's kindle only, basically azw3 chess books have various kindle speific hacks, that dont convert automatically very well.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jul 2021
Device: Kobo Aura One, Kindle android
|
Hmm, understood.
I am editing them manually anyway. So is there some other way that epub svgs can use specific fonts? Inline css? I see that global styles don't automatically apply to them (ex, in stylesheet there is already font-face for text tags but that is not applied within svgs), so somehow the svg needs to say that stylesheet should be applied to it. This seems different from normal browser behaviour. Luckily they also have gifs available for the same images - so i am showing that and hiding the svg. I am planning to remove the hidden svgs and the html referencing them - is that safe to do? Or is there some other asset manifest which i have to edit? Also, for context - in the ebook edit tool, this special svgs preview correctly with font but when the html containing it is previewed, then it doesn't use fonts. The second behavior is consistent with ebook readers, but why the first behavior? |
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jul 2021
Device: Kobo Aura One, Kindle android
|
Thanks, i thought so too.
So, anyway I am editing the epub css manually and my follow up question is - can svgs within epub use any css/font-face? I am ok with editing the svg or css manually. I saw that global styles for text don't automatically apply to them (unlike browsers??), so how do svgs mention that they want this css file to be applied to them. There must be a way to do this, right? |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You are very unlikely to get fonts in svgs to work with most epub renderers, safer to replace the images with rendered versions of the svgs (gif/png/whatever). And yes you can just delete the files from the files browser panel in the editor and it will take care of removing references to the files from the manifest for you.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Jul 2021
Device: Kobo Aura One, Kindle android
|
Thanks. Luckily amazon embeds the gifs too, going with that. (it was fun playing with the font to see how they render full chessboard using a textual svg.)
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Missing font face/styles | Quoth | Conversion | 15 | 03-31-2021 02:47 PM |
Aura H2O ereader font options vs ebook stylesheet | Shadowjack | Kobo Reader | 10 | 05-17-2015 01:40 PM |
@font-face is not embedded | iliakan | Conversion | 2 | 01-12-2015 02:29 AM |
SVG in stylesheet? | AlexBell | ePub | 11 | 12-27-2013 11:26 AM |
Am I using @font-face correctly? | phossler | Sigil | 12 | 11-30-2012 04:38 PM |