Fonts 离子4和离子字体系列

Fonts 离子4和离子字体系列,fonts,ionic4,Fonts,Ionic4,我想给ionic 4添加一种新字体,但我有一个奇怪的问题--Ionion字体系列 步骤: 1:我在assets/font文件夹中加载并设置了自定义字体Roboto Light 2:我用下面的代码更新了variables.css @字体{ 字体系列:“Roboto Light”; src:url('../assets/font/Roboto Light.ttf')格式('truetype'); 字体大小:正常; 字体风格:普通; } --ion字体系列:“Roboto”、“Helvetica N

我想给ionic 4添加一种新字体,但我有一个奇怪的问题--Ionion字体系列

  • 步骤:
  • 1:我在assets/font文件夹中加载并设置了自定义字体Roboto Light
  • 2:我用下面的代码更新了variables.css

    @字体{ 字体系列:“Roboto Light”; src:url('../assets/font/Roboto Light.ttf')格式('truetype'); 字体大小:正常; 字体风格:普通; }

    --ion字体系列:“Roboto”、“Helvetica Neue”、“无衬线”、“Roboto Light”!重要的

我使用google inspector发现默认情况下使用的是什么爱奥尼亚字体,它是“Roboto”、“Helvetica Neue”、“sans serif”。 好啊 现在字体系列使用一种回退策略。 也就是说,它会先尝试,如果浏览器不支持,它会尝试下一个,以此类推

现在,我的问题是: 如果在--ion字体系列的末尾有“Roboto Light”,则不应在主字体中使用它! 事实就是这样


我真的不明白,任何帮助都将不胜感激

我不确定这是否是完整的解决方案,但您的css中有一个错误:

--ion-font-family: "Roboto" , "Helvetica-Neue", "sans-serif", "Roboto-Light" !important;
通用族应始终排在最后:

--ion-font-family: "Roboto" , "Helvetica-Neue", "Roboto-Light", sans-serif !important;