MVC 4 Google Fonts - Intranet

前端 未结 3 1614
陌清茗
陌清茗 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.

    0 讨论(0)
  • 2021-01-06 17:40

    I have a similar issue with font awesome below listed is my current bundle value and this solved the issue with additional references from Font-Awesome.css file

    bundles.Add(new StyleBundle("~/Framework/libs/vendor/font-awesome/4.4.0/css/font-awesome").Include(
                "~/Framework/libs/vendor/font-awesome/4.4.0/css/font-awesome.css"));
    

    when the path is relative the to the actual font-awesome css file the relative path to the eot,tff and woff files will also become correct.

    0 讨论(0)
  • 2021-01-06 17:42

    put this code in head tag

    <link href='http://fonts.googleapis.com/css?family=Montserrat:400' rel='stylesheet' type='text/css'>
    
    0 讨论(0)
提交回复
热议问题