Live data from Hacker News

Icon fonts and their usefulness in iOS development

kylerosenbluth.com

11–20 of 24 posts

Re: Icon fonts and their usefulness in iOS development

#12
post #2

Ok, I might be a bit slow. Can somebody explain to me the advantage of using a font file instead of a sprite png? I understand that there would be advantages with a high resolution display. It would scale automatically. Anything beside that?

It's just easier. With a pngs you have to scale, size and filter appropriately with an image editor, and keep track of all of them. With an icon font, you just do font-size: 24px, and if that's too large, 18px. Change the colour? color: red. And you only have one file to deal with.

Re: Icon fonts and their usefulness in iOS development

#13
post #2

Ok, I might be a bit slow. Can somebody explain to me the advantage of using a font file instead of a sprite png? I understand that there would be advantages with a high resolution display. It would scale automatically. Anything beside that?

The better question is what does this gain you over a vector format.

Can you do sprites with a svg, though? If not, there's the single file aspect.

Re: Icon fonts and their usefulness in iOS development

#14
post #13

Earlier quoted context omitted.

The better question is what does this gain you over a vector format.

Can you do sprites with a svg, though? If not, there's the single file aspect.

I just started using it icon fonts. I was initially using SVGs using an IMG tag, but the issue there is that you can't change color, opacity, or style it with CSS.

You can sprite SVGs, but you have to maintain it just as you would have to maintain a sprite of PNGs. The only advantage being that a sprited SVG would scale to a HDPI monitor without needing a second set of higher resolution images.

I ended up going with icon fonts because it requires significantly less CSS than dealing with the position of an icon in a sprite. I actually find it is easier to maintain since I can style icons with shadows, opacity, color, etc.

One drawback, using icon fonts generally means having flat icons. You can't have fancy 3D-like iconography.

Re: Icon fonts and their usefulness in iOS development

#15
post #2

Ok, I might be a bit slow. Can somebody explain to me the advantage of using a font file instead of a sprite png? I understand that there would be advantages with a high resolution display. It would scale automatically. Anything beside that?

The better question is what does this gain you over a vector format.

And the answer to that question is autohinting and (not on iOS) subpixel AA.

Re: Icon fonts and their usefulness in iOS development

#16
post #13

Earlier quoted context omitted.

The better question is what does this gain you over a vector format.

Can you do sprites with a svg, though? If not, there's the single file aspect.

Check out this: http://simurai.com/post/20251013889/svg-stacks

Re: Icon fonts and their usefulness in iOS development

#17
What, no FF Chartwell?

http://tktype.com/chartwell.php

As long as you can turn on ligatures in your font rendering API per-platform, this is a fully cross-platform solution to graphing, in a font file.

(Using printf's, basically, to do complicated graphs - absurd and awesome!)

Re: Icon fonts and their usefulness in iOS development

#18
post #13

Earlier quoted context omitted.

The better question is what does this gain you over a vector format.

Can you do sprites with a svg, though? If not, there's the single file aspect.

You can reference a viewBox when referencing an SVG. This uses fragment notation in the URI. It would clash a little with a proposed syntax for native sprites for images (was recently brought up on the www-svg mailing list), I don't know whether or how it was resolved yet.

Re: Icon fonts and their usefulness in iOS development

#19

Earlier quoted context omitted.

The better question is what does this gain you over a vector format.

And the answer to that question is autohinting and (not on iOS) subpixel AA.

How well hinted are the common icon fonts, actually? Given that many (if not most) freely-available typefaces are actually not hinted at all I'd be a bit skeptical. Autohinting doesn't really produce very convincing results for typefaces, I wouldn't expect it to do wonders with images either.

Re: Icon fonts and their usefulness in iOS development

#20
post #2

Ok, I might be a bit slow. Can somebody explain to me the advantage of using a font file instead of a sprite png? I understand that there would be advantages with a high resolution display. It would scale automatically. Anything beside that?

The better question is what does this gain you over a vector format.

It's supported in places where a vector format is not (namely, older versions of IE that don't support SVG).

Plus, icons are easier to handle as a regular text/font asset, than as SVG, and you can use all the tools available for web typography for them.

That said, why we never had a simple vector _IMAGE_ format for the web is beyond me.

By which, I mean a simple format to display vector images at various sizes, a simple vector decoder, with no animation, javascript, styling and other stuff. A JPEG/PNG equivalent for static vector images.

That would be dead easy to add support for, compared to SVG (just treat as any other image format) and it would handle lots of use cases.

Post reply on HN