bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Icons as font instead of img

Open andriijas opened this issue 14 years ago • 155 comments

Hi

Any reason you opted to include image based icons in bootstrap which are limited to the 16px dimensions?

For example http://somerandomdude.com/work/iconic/ is available as open source fonts - means you can include icons in headers, buttons of various size etc since its vector based.

Could easily be implemented with the same approach as the current icons:

i.foobar:before { content: "X" }

andriijas avatar Jan 11 '12 12:01 andriijas

Yes, I second this. It would allow size and color to change (black doesn't look good on .danger, for example)

Antariano avatar Jan 11 '12 12:01 Antariano

There are forks that have this implemented: For version 1.4 have a look at https://github.com/lightglitch/bootstrap-xtra (http://lightglitch.github.com/bootstrap-xtra/) For version 2.0 you can use https://github.com/jasny/bootstrap/tree/2.0-icons

I'm not expecting that this will end up in the main version of bootstrap.

jasny avatar Jan 11 '12 12:01 jasny

I know this is why Im surprised bootstrap opted to lock them self in to the 16px corner which feels a little unorthodox to do in 2012.

andriijas avatar Jan 11 '12 12:01 andriijas

It boils down to two things:

  • There isn't much out there for open source icon fonts. It's a market that I suppose is wide open, but for now extremely limited.
  • Aesthetically, I have a high bar and particular style I'd like to support for iconography in Bootstrap. Glyphicons gets us close to that for now.

I'm not opposed to using fonts—that'd be pretty awesome. It's just a matter of availability and quality. if anyone else has other suggestions for a font family to use, do pipe up and I'll check it out.

mdo avatar Jan 11 '12 21:01 mdo

I'm a fan of iconic due to their licensing and quality.

geoffreytran avatar Jan 11 '12 21:01 geoffreytran

@andriijas thanks for the link, nice icon sets!

pokonski avatar Jan 12 '12 18:01 pokonski

@markdotto With the vector images of Glyphicons, you can easily create a font. Unfortunately this is difficult license wise. Perhaps you can talk with the designer.

jasny avatar Jan 12 '12 19:01 jasny

@jasny, Glyphicons in bigger sizes are sold premium :(

pokonski avatar Jan 12 '12 19:01 pokonski

Using a font also brings the affordance of better color control. The pure black icons (in my opinion) don't mesh well with the off-black text.

JakeWharton avatar Jan 12 '12 19:01 JakeWharton

@pokonski Well sure, I'm willing to pay the 49 bucks. That still doesn't allow me to put it in bootstrap I'm afraid, since you're not allowed to distribute them. http://glyphicons.com/glyphicons-licenses/

jasny avatar Jan 13 '12 00:01 jasny

As a FYI, I talked to Jan about it over email and he granted us use of the Halflings in Bootstrap so long as they are credited. To help further, I only added a sprite version of the icons—no individual files are added, so that helps him out some.

mdo avatar Jan 13 '12 03:01 mdo

I'm sure it does. Used by thousands and promoted by Twitter :)

pokonski avatar Jan 13 '12 06:01 pokonski

Will it at least be possible to exclude these built icons and the additional http request of an image for those who would like to use something else?

@jasny If id like to use https://github.com/jasny/bootstrap/blob/2.0-icons/lib/icons.less with main bootstrap, do I just need to include that icon.less in my less file or do I need anything else (except the font of course)?

andriijas avatar Jan 13 '12 06:01 andriijas

@andriijas No that's not the way to do it. I've also modified mixins.less.

You can do a merge (with -Xours) and rebuild bootstrap. You can also fetch my fork and do a cherrypick. The whole thing is in commit https://github.com/jasny/bootstrap/commit/54b22aa388d79a67e072ea54f8429b3b427b9d11

jasny avatar Jan 13 '12 18:01 jasny

here are some good ones too: http://www.ffdingbatsfont.com/erler/index.html FF encourages OS devs to include it.

burningTyger avatar Jan 13 '12 22:01 burningTyger

I'll play devils advocate and throw out the issue that using fonts/font-face for icons can and does cause some accessibility concerns. For instance if you use :before or :after to generate content to show an icon, a large majority of screen readers will read that content. (not to mention ie support). If you used the current technique of <i>x<i> some text with an icon in front of it, they would also read the "x". If you were using js to create them that may be a different, I'm not sure on that.

Maybe if it was optional, and the sprite version was still included?

brentkirby avatar Jan 18 '12 15:01 brentkirby

I've found this Set: Web Symbols Typeface http://www.justbenicestudio.com/studio/websymbols/

Web Symbols is a set of vector html-compliant typefaces, so it might be used in any size, color and browser. License OFL

m5o avatar Jan 25 '12 20:01 m5o

I approve of websymbols!

Antariano avatar Jan 25 '12 22:01 Antariano

These might be worth a look... apparently they are supposed to be accessible and won't be read by screen readers (nice set too) http://keyamoon.com/icomoon/#toHome

brentkirby avatar Jan 26 '12 01:01 brentkirby

actually, what would be the coolest - is if any icon guru would like to make a dedicated bootstrap icon font.

andriijas avatar Jan 26 '12 06:01 andriijas