MVC 4 Google Fonts - Intranet

前端 未结 3 1650
陌清茗
陌清茗 2021-01-06 16:43

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 th

3条回答
  •  情书的邮戳
    2021-01-06 17:23

    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.

提交回复
热议问题