Forum How do I...?

svg to pdf - how to include special fonts

roshu
Hey guys,

I have a SVG, with a font integrated in it (the font was ttf got converted to svg and integrated into the svg file). When I convert it to PDF it does not use the fonts in the SVG, it uses time-new-roman or something. This is understandable but the question remains: Having the ttf fonts, how do I tell prince to use them when it is converting the svg to pdf. (the svg file contains tags that have the font-family defined inline E.g.: <tspan x="0" y="0" font-family="MyriadPro-Regular" font-size="14">...</tspan> )
mikeday
Prince currently does not support SVG fonts, but it does support TrueType fonts. Is the font installed as a system font under the name MyriadPro-Regular? Or just MyriadPro? If it is not installed as a system font, you can point directly to the font file with a @font-face rule.
roshu
Mike,

thanks a lot for being so quick. It's ok that is does not support the svg fonts. What I do now, using your php lib, is this:

1. $prince = new Prince(prince_path);
$prince->addStyleSheet("/var/www/css/fonts.css");

2. in fonts.css i have this:
@font-face { font-family: MyriadPro-Regular; src: url('/var/www/fonts/MyriadPro-Regular.ttf'); }

Is this the correct way to do it ? if yes ... it is not working, I have some issue somewhere :(, or the font must be installed as a system font for it to work.
roshu
ok ... it actually works :) .. I had a mistake in the path :(