Closed dominikh closed 6 months ago
Nice catch, thank you. loadFromDisk
should return the whole slice of faces, which should be added in the cache in loadFont
Hum, it is not as simple as I had thought, because the other faces in a font collection do not have the same footprint. And, for now, we do not have a simple face -> metadata method (this is #113).
Well, alternatively, we shouldn't use LoadTTC and instead only load the requested font from the collection, not all fonts. We'll still parse the TTC header repeatedly, but we won't have to load every font included in the collection every time.
If I understand correctly,
(*FontMap).loadFont
callsFootprint.loadFromDisk
, which might parse an entire TTC, only to return a singlefont.Face
, which gets cached byloadFont
. ISTM that if we need multiple fonts from the same font collection, then we repeat a lot of parsing. Shouldn't we instead cache all faces from the collection?