MVC 4谷歌字体

编程入门 行业动态 更新时间:2024-10-24 12:33:17
MVC 4谷歌字体 - 内联网(MVC 4 Google Fonts - Intranet)

我有一个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.

更多推荐

本文发布于:2023-08-07 16:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465112.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字体   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!