无法在Rails邮件中应用字体

时间:2018-10-17 11:41:00

标签: ruby-on-rails actionmailer

我有一种叫做 EngraversGothicBT 的字体。我找不到为什么在用户注册后立即发送的邮件中未应用此字体的原因。

我对此有以下css:

<!DOCTYPE html>
<html>
  <head>
    <title>noname</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>

      @font-face {
        font-family: 'EngraversGothicBT';
        src: url('/assets/EngraversGothicBT.eot');
        src: url('/assets/EngraversGothicBT.eot') format('embedded-opentype'),
             url('/assets/EngraversGothicBT.woff2') format('woff2'),
             url('/assets/EngraversGothicBT.woff') format('woff'),
             url('/assets/EngraversGothicBT.ttf') format('truetype'),
             url('/assets/EngraversGothicBT.svg#EngraversGothicBT') format('svg');
       font-weight: normal;
       font-style: normal;
  }

      @media only screen and (max-width: 967.99px){
        .central-image {
          height: auto !important;
        }
      }
      @media only screen and (max-width: 692px){
        .central-image a {
          height: 110px !important;
        }
      }
      @media only screen and (max-width: 620px){
        .main-table {
          padding: 0 15px !important;
        }
        td.border {
          padding:30px 35% 0 !important;
        }
        td.custom-height {
          line-height: 0.8 !important;
        }
        td.footer-border {
          padding:3px 40% 0 !important;
        }
      }
      @media only screen and (max-width: 490px){
        .central-image a {
          height: 98px !important;
        }
        .table-subtitle p {
          font-size: 15px !important;
        }
        .table-with-text p {
          font-size: 12px !important;
        }
        .footer a {
          font-size: 11px !important;
        }
      }
      @media only screen and (max-width: 410px){
        .central-image a {
          height: 85px !important;
        }
      }
      @media only screen and (max-width: 380px){
        .table-welcome {
          margin-top: 55px !important;
        }
      }
      @media only screen and (max-width: 370px){
        .central-image a {
          height: 70px !important;
        }
      }
    </style>
  </head>

  <body style="margin:0; padding:0; font-family:'EngraversGothicBT', sans-serif; font-weight: 400; font-size: 18px; color: #202220;">
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
      <%= yield %>
    </table>
  </body>
</html>

所有字体都位于/ assets / fonts路径内,所以我认为src路径应该正确。我不知道我在这里想念什么。

0 个答案:

没有答案