QT中使用fontawesome-webfont.ttf字体库

QT中使用fontawesome-webfont.ttf字体库
fontawesome-webfont.ttf

https://fontawesome.com/

http://www.fontawesome.com.cn/cheatsheet/

参考链接1

https://github.com/Gamecreature/qtawesome

在这里插入图片描述
QtAwesome - Font Awesome support for Qt applications

QtAwesome is a simple library that can be used to add Font Awesome icons to your Qt application.

NOTE: Though the name is QtAwesome and currently it’s very Font Awesome based, you can use every other icon/glyph font you want.

The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters.
Updated to FontAwesome 4.7.0

Installation
The easiest way to include QtAweome in your project is to copy the QtAwesome directory to your project tree and add the following include() to your Qt project file:

include(QtAwesome/QtAwesome.pri)
Now you are good to go!

You probably want to create a single QtAwesome object for your whole application:

QtAwesome* awesome = new QtAwesome( qApp )
awesome->initFontAwesome();     // This line is important as it loads the font and initializes the named icon map

Add an accessor to this object (i.e. a global function, member of your application object, or whatever you like).
Use an icon name from the Font Awesome Cheatsheet.
https://fontawesome.com/cheatsheet

参考链接2

如何将 Font Awesome 转成 PNG 图标 详细教程 含源代码
https://blog.csdn.net/weixin_30511107/article/details/99010841

font-awesome-to-png.py

参考链接3

icon-font-to-png-master
https://github.com/Pythonity/icon-font-to-png

另外一个

https://github.com/Pythonity/font-awesome-to-png

Examples
Export the “play” and “stop” icons as 24x24 pixels images:

font-awesome-to-png.py --size 24 play stop
Export the asterisk icon as 32x32 pixels image, in blue:

font-awesome-to-png.py --size 32 --color blue asterisk
Export all icons as 16x16 pixels images:

font-awesome-to-png.py ALL

在这里插入图片描述

链接5

https://fontawesome.com/v4.7.0/cheatsheet/

https://fontawesome.com/v4.7.0/icons/

在这里插入图片描述
font-awesome-to-png\Font-Awesome-4.7.0\css
font-awesome.css
在这里插入图片描述
Font-Awesome-4.7.0\fonts
fontawesome-webfont.ttf
在这里插入图片描述

3、使用举例:我们想加载一个“咖啡”图标:

首先在font-awesome.css文件中查找其编码,这是我们程序中需要使用的:

 fa-search-plus []
 fa-heart []

1、fontawesome-webfont.ttf字体库中包含了很多图标,
每个图标都对应一个编码,
所以我们通过字体编码来加载所需要的图标。

2、字体库的下载地址:http://www.bootcss.com/p/font-awesome/。
下载完成后我们找到fontawesome-webfont.ttf文件,
他是我们需要的字体库,我们可以将字体库加载到资源中引用;
找到font-awesome.css文件,它是查找每个图标所对应的编码所需要的,
一个更快捷的查找图标编码的方式是:快捷查找图标所对应的编码。

font awesome字体是一款非常美观的字体

这两种不同

在这里插入图片描述
在这里插入图片描述

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值