Thread: SVG and fonts
View Single Post
Old 05-20-2024, 04:42 PM   #3
chrisridd
Guru
chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.chrisridd ought to be getting tired of karma fortunes by now.
 
chrisridd's Avatar
 
Posts: 983
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
Quote:
Originally Posted by RbnJrg View Post
It's not easy the answer, specially if you want to do the things by hand. My advice is that you use Inkscape to generate the .svg image, save it as plain svg and then insert that file to your epub.
I'm using Affinity Designer, exporting as SVG "Digital small size" - some sort of "profile" anyway - which means the text comes out as:

<text x="248.563px" y="641.791px" style="font-family:'DINAlternate-Bold', 'DIN Alternate', sans-serif;font-weight:700;font-size:12px;">Height</text>

That looks pretty plausible. The names match the various names in the TrueType file.

Quote:
Originally Posted by RbnJrg View Post
PocketBook has two render engines; one based on RMSDK for epub2 and one based on webkit for epub3. What kind of epub are you working on?
Ah, good point. I'm using epub3.

Quote:
Originally Posted by RbnJrg View Post
The font you want for your svg, is it embedded in your epub? Because svg honors embedded fonts.
Yes it is embedded in the epub. It is not used by anything in the HTML or CSS, only by name in the SVG (see above) and in the OPF:

<item id="DIN_Alternate_Bold.ttf" href="Fonts/DIN%20Alternate%20Bold.ttf" media-type="font/ttf"/>

And the whole point of my post was that it is not honouring the embedded font.

Quote:
Originally Posted by RbnJrg View Post
And the easiest way to use that font (or fonts) is by mean of the tag <foreignObject>:
Ah, that's interesting. It seems a bit perverse to do that instead of svg:text but if it works... I will try that later.
chrisridd is offline   Reply With Quote