我有一个MVC4 4 Bootstrap项目,通过Visual Studio 2010本地呈现完美,但是当我发布到用于Intranet的内部IIS时,我无法访问资源http://fonts.googleapis.com/css?family=Montserrat:400所以有人可以解释我如何本地化这个远程资源,以便IIS在本地引用它。
任何帮助将非常感激 :-)
I have a MVC4 4 Bootstrap project which renders perfectly well locally via Visual Studio 2010 but when I publish to the internal IIS used for our Intranet I cannot access the resource http://fonts.googleapis.com/css?family=Montserrat:400 so could somebody explain how I localise this remote resource so that IIS references it locally.
Any help would be much appreciated :-)
最满意答案
为了本地化Google字体,我将地址http://fonts.googleapis.com/css?family=Montserrat:400添加到我的浏览器地址栏中,该地址栏返回一个css文件。
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; src: url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot); src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot) format('embedded-opentype'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); }然后,我将上述css中的每个url添加到我的地址栏中,该地址栏下载了相关的.eot和.woff文件。 我只是用更合理的名称重命名下载的文件,并将这些文件复制到/ Content / fonts目录中。
然后我将以下内容加入到我的boostrap.css文件中。
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; src: url(fonts/montserrat-400.eot); src: local('Montserrat-Regular'), url(fonts/montserrat-400.eot) format('embedded-opentype'), url(fonts/montserrat-400.woff) format('woff'); }嘿presto,所有字体在内部IIS服务器上正确呈现。
To localise the Google Fonts I added the address http://fonts.googleapis.com/css?family=Montserrat:400 in to my browser address bar which returns a css file.
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; src: url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot); src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot) format('embedded-opentype'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); }I then added each url from the above css into my address bar which downloaded the associated .eot and .woff files. I simply renamed the downloaded files with a more logical name and copied the files into the /Content/fonts directory.
I then included the following into my boostrap.css file.
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; src: url(fonts/montserrat-400.eot); src: local('Montserrat-Regular'), url(fonts/montserrat-400.eot) format('embedded-opentype'), url(fonts/montserrat-400.woff) format('woff'); }Hey presto, all fonts render correctly on an internal IIS server.
更多推荐
发布评论