将新字体添加到Google的下拉列表中

时间:2018-10-02 19:03:00

标签: css webfonts google-font-api

我想在网站上添加波斯字体(CMS = Wordpress)。在主题选项中,有一个字体下拉列表。这些字体在文件google.json中。例如,在此文件中,字体定义如下:

  {
   "kind": "webfonts#webfont",
   "family": "Abel",
   "category": "sans-serif",
   "variants": [
    "regular"
   ],
   "subsets": [
    "latin"
   ],
   "version": "v6",
   "lastModified": "2016-09-29",
   "files": {
    "regular": "http://fonts.gstatic.com/s/abel/v6/RpUKfqNxoyNe_ka23bzQ2A.ttf"
   }
  },

现在我要在此文件中定义以下字体:

@font-face {
    font-family: 'BYekan';
    src: url('../font/BYekan.eot');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'BYekan';
    src: url('../font/BYekan.eot') format('eot'),
         url('../font/BYekan.woff') format('woff'),
         url('../font/BYekan.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

因此,我在BYekan文件中定义了一种google.json字体,如下所示:

   {
   "kind": "webfonts#webfont",
   "family": "BYekan",
   "category": "sans-serif",
   "variants": [
    "regular"
   ],
   "subsets": [
    "latin"
   ],
   "version": "v6",
   "lastModified": "2016-09-29",
   "files": {
    "regular": "../font/BYekan.ttf"
   }
  },

但是新字体不会出现在下拉列表中。我也用过ctrl + f5

0 个答案:

没有答案