我们如何在SVG图像中设置自定义字体?

时间:2017-06-02 17:08:42

标签: javascript php html svg

我在样式表中添加了自定义字体,并希望包含在SVG中,但它不会加载自定义字体。如何在SVG中添加自定义字体?以下是SVG代码:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" width="1024" height="768">
<defs>

        <link href="fonts.css" type="text/css" rel="stylesheet" xmlns="http://www.w3.org/1999/xhtml"/>

</defs>
<g>
    <title>background</title>
    <rect x="-1" y="-1" width="100%" height="100%" id="canvas_background" fill="#fff"/>
    <g id="canvasGrid" display="none">
        <rect id="svg_2" width="100%" height="100%" x="0" y="0" stroke-width="0" fill="url(#gridpattern)"/>
    </g>
</g>
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
    <title>background</title>
    <rect fill="#fff" id="canvas_background" height="100%" width="100%" y="-1" x="-1"/>
    <g display="none" id="canvasGrid">
        <rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%" id="svg_2"/>
    </g>
</g>
<g>
    <title>background</title>
    <rect x="-1" y="-1" width="100%" height="100%" id="canvas_background" fill="#fff"/>
    <g id="canvasGrid" display="none">
        <rect id="svg_2" width="100%" height="100%" x="0" y="0" stroke-width="0" fill="url(#gridpattern)"/>
    </g>
</g>
 <g>
    <title>Layer 1</title>
    <text opacity="0.65" stroke="#000000" transform="matrix(0.323552, 0, 0, 1.60358, 525.282, -195.77)" xml:space="preserve" text-anchor="middle" font-family="gallardo" font-size="153.6" stroke-miterlimit="10" id="svg_2" y="482.50282" x="-67.52708" stroke-width="2" fill="#000000">We bring your ideas to print</text>
</g>
</svg>

0 个答案:

没有答案