我正在使用SVG的Web应用程序。使用谷歌字体apis
该计划是使用Google Webfonts API让用户选择他们的字体类型,然后在SVG中呈现其名称。问题是,当我使用Google API访问字体时,它不起作用(恢复为Serif字体)。然而,当我下载谷歌字体,然后直接在我的Web应用程序中引用,它的工作原理... 有人可以请阐明如何让这个web应用程序的工作。
这是迄今为止代码:
js.onclick=function()
{
var val=document.getElementById("txt").value
var newText = svgDoc.createElementNS("http://www.w3.org/2000/svg","text");
newText.setAttribute("id", "txxt")
newText.setAttribute("x",275);
newText.setAttribute("y",250);
newText.setAttribute("font-size","50px");
newText.setAttribute("fill","olive");
newText.setAttribute("xlink:href",'http://fonts.googleapis.com/css?family=Josefin+Sans+Std+Light&subset=latin');
newText.setAttribute("font-family",'JosefinSansStd-Light');
var textNode = document.createTextNode(val);
newText.appendChild(textNode);
svgRoot.appendChild(newText)
}
为什么所有的降薪呢? – Frank 2010-10-12 07:27:07
我的猜测:拼写错误的标题(“Probelm in using google font apis”) – jsalonen 2010-10-12 11:29:10