代码之家  ›  专栏  ›  技术社区  ›  K. van den Berg

为什么我的Angular材质图标看起来与谷歌字体图标不同?

  •  1
  • K. van den Berg  · 技术社区  · 1 年前

    我正在做一个Angular 15项目,我注意到我使用的垫子图标组件看起来与谷歌字体图标网站上显示的图标不同( https://fonts.google.com/icons ). 例如,我使用以下代码在我的项目中包含“上传”图标:

    <mat-icon>upload</mat-icon>
    

    为了加载图标,我在index.html中添加了以下行:

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet">
    

    然而,我的应用程序中呈现的图标与谷歌字体图标网站上显示的设计不匹配。

    出现在我的Angular项目中的图标: upload icon in my app

    谷歌字体图标网站上显示的图标: upload icon of google font

    我想知道为什么外观上有区别。在如何在Angular Material中包含或配置图标方面,我是否缺少了什么?

    1 回复  |  直到 1 年前
        1
  •  3
  •   JSON Derulo    1 年前

    材质图标字体有两个不同的版本,您可以在谷歌字体网站的侧边栏“样式”部分进行选择:

    1. 材料符号
    2. 材质图标

    Screenshot of the Material Icon Font style select

    在您的应用程序中,您正在使用材质图标,其外观可能与材质符号中的图标不同。有一个 open feature request 对于Angular Material中的官方材质符号支持。