Add a `FontCollection::into_fonts` method.
Created by: mitchmindtree
This is a convenience method that allows the user to convert a FontCollection
into an iterator yielding each available font within the collection. I'm about to do something similar within conrod, but thought I might put it in a PR in case anyone else found it useful.
I would have used the FontCollection::font_at
method to simplify the body of IntoFontsIter::next
, but the lifetime of fonts returned from that method are bound to the instance of the FontCollection
itself and not the internal SharedBytes (which is required by IntoFontsIter
). I wasn't sure whether or not this was your intention, so I decided to leave the FontCollection::font_at
method and duplicate the couple of lines that I needed instead.
Edit: looks like someone else has run into the font_at
issue too #22. If you decide to accept it, I'd be happy to refactor this PR to use font_at
rather than duplicating the logic