【发布时间】:2015-06-12 04:59:50
【问题描述】:
svg 字体有问题。
这是我的 index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<img src="sign.svg"></img>
</body>
</html>
这是我的 svg 文件
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 47.2 110 20.6" enable-background="new 0 47.2 110 20.6" xml:space="preserve">
<defs>
<style type="text/css">
@font-face {
font-family: 'Indie Flower';
font-style: normal;
font-weight: 400;
src: url('http://fonts.gstatic.com/s/indieflower/v7/10JVD_humAd5zP2yrFqw6qRDOzjiPcYnFooOUGCOsRk.woff') format('woff');
}
</style>
</defs>
<text transform="matrix(1 0 0 1 23.4251 58.5378)" fill="#004888" font-family="'Indie Flower'" font-size="12">My sign</text>
</svg>
在我的 Mac 上的 Safari 中,字体看起来应该是这样
但在其他任何地方,该字体都显示为常规字体
在 iPhone 上根本不出现。
如果在常规 css 中使用此字体,它会在任何地方正确呈现。 你能告诉我我做错了什么吗?
【问题讨论】:
-
sign.svg 是否保存在正确的内容类型中,并且 sign.svg 是位置?
-
如果 css 有效,为什么要使用 SVG?
-
@Pierre Granger,我想使用 Illustrator 创建一个标识
-
@Cas Bloem,我不确定内容类型,您可以从我的问题中的 svg 文件中查看所有信息。是的 sign.svg 是一个文件。
-
也许你需要为你的字体导入一个svg文件,比如
url('http://....svg') format(''svg'),但我无法测试,因为我在网上找不到svg文件:(