NewCache creates a new cache of fonts from the provided collection of font Faces. The first font Face in the collection is set to be the default one.
(coll Collection)
| 211 | // font Faces. |
| 212 | // The first font Face in the collection is set to be the default one. |
| 213 | func NewCache(coll Collection) *Cache { |
| 214 | cache := &Cache{ |
| 215 | faces: make(map[Font]*opentype.Font, len(coll)), |
| 216 | } |
| 217 | cache.Add(coll) |
| 218 | return cache |
| 219 | } |
| 220 | |
| 221 | // Add adds a whole collection of font Faces to the font cache. |
| 222 | // If the cache is empty, the first font Face in the collection is set |