【问题标题】:How to include a non-standard font-face in azure?如何在 azure 中包含非标准字体?
【发布时间】:2014-05-23 22:32:50
【问题描述】:

就此而言,我是云和 Azure 的新手,我为我今天工作的公司进行了第一次部署。

它目前位于http://fleetcarma.cloudapp.net,直到我能够获取域名以与 azure 服务器进行验证。

所以有些事情真的很奇怪,当我在本地运行我的 Web 服务或部署在 IIS 上时,我想使用的字体可以工作。但是,当部署到 Azure 时,它​​不会,并且默认为类似 time new roman 之类的东西。

我也包含了不同的字体类型。

这是 CSS:

@font-face {
font-family: 'SlateStdBk';
src: url('/Content/ACTExpo/slatestd-bk1-webfont.eot');
src: url('/Content/ACTExpo/slatestd-bk1-webfont.eot?#iefix') format('embedded-opentype'),
     url('/Content/ACTExpo/slatestd-bk1-webfont.woff') format('woff'),
     url('/Content/ACTExpo/slatestd-bk1-webfont.ttf') format('truetype'),
     url('/Content/ACTExpo/slatestd-bk1-webfont.svg#SlateStdBk') format('svg');
font-weight: normal;
font-style: normal;
}

我已将字体包含在内容文件夹中。我看过这个:How can I install custom fonts on Windows Azure?,但这对我不起作用,因为我必须绘制所有文本,对吗?

如果有人能帮忙,我将不胜感激。 提前谢谢你。

【问题讨论】:

  • 我的浏览器尝试下载这些字体文件并得到 404。看起来这些字体未与您的应用程序一起部署。确保文件被标记为内容。
  • 啊,是的!太感谢了。事实证明,我需要 Visual Studio 将这些字体文件标记为属性中的内容。抱歉这个愚蠢的问题,谢谢你的回答。

标签: css asp.net-mvc-3 c#-4.0 azure font-face


【解决方案1】:

感谢@Seva Titov,我遇到了同样的问题,在属性的“构建操作”下选择“内容”后,它就像一个魅力!

【讨论】:

    【解决方案2】:

    对于那些将某些东西推向天蓝色并且不熟悉 web 配置或非 .net 语言的人,您仍然可以创建 web.config。

    第 1 步:最佳做法,您不应在真实的实时服务器上执行此操作:

    • 第 1 步:启用“在 Visual Studio Online 中编辑”
    • 门户 -> 网站 -> 您的网站 -> 配置选项卡
    • 将 Visual Studio Online 中的编辑设置为开启(注意警告)
    • 保存

    第 2 步:在目录的根目录中创建一个名为“web.config”的新文件 它应包含以下内容:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <staticContent>
          <remove fileExtension=".woff" /> <!-- In case IIS already has this mime type -->
          <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
        </staticContent>    
      </system.webServer>
    </configuration>
    

    【讨论】:

      【解决方案3】:

      为您的自定义字体添加

      <staticContent>
            <mimeMap fileExtension=".woff" mimeType="font/woff" />
      </staticContent>
      

      &lt;system.webServer&gt; Web.config 部分

      【讨论】:

        猜你喜欢
        • 2015-07-08
        • 2013-03-07
        • 1970-01-01
        • 2018-03-01
        • 2021-12-15
        • 2021-09-12
        • 1970-01-01
        • 2015-03-13
        • 1970-01-01
        相关资源
        最近更新 更多