标签:
Font Awesome 是一套专门为 Twitter Boostrap 设计的图标字体库。这套图标字体集几乎囊括了网页中可能用到的所有图标,除了包括 Twitter Boostrap 的默认图标外,还有社交网络图标、Web 应用程序图标和编辑器图标等等,可以免费用于商业项目。
主要特色:
? 一种字体,249个图标,是网页操作的象形语言;
? 纯 CSS 控制,能够轻松定义图标的颜色、大小、阴影以及任何 CSS 能够实现的效果;
? 无限缩放,矢量图标在任何尺寸下都一模一样;
? 免费使用,包括商业和非商业项目;
? 支持 Internet Explorer 7 浏览器;
? 能够在 Retina 屏幕完美呈现;
? 完全兼容 Twitter Boostrap 最新版本;
? 对设计师友好,设计师能够轻松使用;
? 和其它图标字体不同,兼容屏幕阅读器;
Every application or operating system needs icons, small images symbolizing concepts or actions that are easier to recognize and locate than written texts. They used to be 16x16
pixels but with increased screen resolutions like retina displays we need much bigger images: 64x64
, 256x256
or even higher. The ‘ole good 16x16
just do not look good anymore.
The idea of font icon is simple: fonts are not bitmap images but vector shapes so if we draw a shape and assign it to a character in a font we get scalable and resolution independent icon that looks good at any size. So that‘s font icon.
Sure, one icon is not enough, and a couple of special glyphs in standard fonts as Arial also won‘t do designers and developers put together collections of useful shapes, icons into specialized fonts, icon fonts.
If you google for "icon font" you find many of them, they are increasingly popular. Here is the list of a few of them:
Take a look at all icons at FontAwesome site. There are about 370 icons in 8 categories, the selection that should be enough for a majority of applications.
Each icon has a symbolic name that is CSS class in fact. If you click on an icon, you see the icon details. The most important information is:
f14e
for fa-compass
HTML markup to show an icon, e.g.
<i class="fa fa-compass"></i>
拷贝 Font Awesome 字体目录到项目中;
拷贝 font-awesome.min.css 文件到项目中;
修改 font-awesome.min.css 文件中的字体路径到正确的位置;
在页面的 head 里引入 font-awesome.min.css 文件:
<link rel="stylesheet" href="../css/font-awesome.min.css">
The aforementioned way is fine for showing icons in text but in Ext we want icons in headers, buttons, menu items, etc. How to go about that?
Fortunately, it‘s very easy. Many components have configuration option glyph
that takes unicode of the icon plus the optional font family name. That is enough to show the font icon (besides including the font stylesheet in the head).
Button configuration would then look like this:
Ext.widget(‘button‘, { text:‘Save‘, glyph:‘xf0c7@FontAwesome‘ });
Ext.widget(‘panel‘, { title:‘Info Panel‘ ,border:true ,glyph:‘xf05a@FontAwesome‘ });
Nobody likes too much typing of font name in every glyph so we would rather call
Ext.setGlyphFontFamily(‘FontAwesome‘);
early in app.js (init or launch method of Application).
The we would then configure our button and panel like this:
Ext.widget(‘button‘, { text:‘Save‘ ,glyph:0xf0c7 }); Ext.widget(‘panel‘, { title:‘Info Panel‘ ,border:true ,glyph:0xf05a });
Important: Mind that the type of glyph
in the above code is number
, not string. The global glyph font family is ignored if glyph
type is string
.
标签:
原文地址:http://www.cnblogs.com/mumutouv/p/4279041.html