字体图标(Font Icon)
详细描述
字体图标是一种特殊类型的字体,显示给用户时呈现为图片。字体图标是矢量图像,可以根据需要进行缩放,而不会失去清晰度。
首先,将一个 CSS 文件添加到应用程序中:
/* .css */
@font-face {
font-family: 'icon-font';
src: url('fontIcons.eot');
src: url('fontIcons.woff2') format('woff2'),
url('fontIcons.woff') format('woff'),
url('fontIcons.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
.Icon {
font-family: "icon-font";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-smoothing: antialiased;
line-height: 16px;
text-align: center;
}
Then we create a button.
// .ts
const desktop = Desktop.instance();
new Button(desktop, 'Button', '');
当我们增加浏览器的缩放级别时,字体图标仍然保持高分辨率和清晰度。
![]()