The decisions behind the font registry: who owns each slot's font, when a swap has nothing to do, and when a font can be freed.
More...
|
| static bool | slot_in_range (const FontSlots *slots, int id) |
| | Whether a slot id is inside the tables.
|
| void | font_slots_put (const FontSlots *slots, int id, void *handle, bool owned) |
| | Puts a font in a slot, overwriting whatever it held without freeing it.
|
| bool | font_slots_load (const FontSlots *slots, uint32_t *resources, int id, uint32_t resource, FontSlotLoad load) |
| | Loads a font into a slot and records the resource it came from.
|
| static void | let_go (const FontSlots *slots, int id, FontSlotUnload unload) |
| | Lets go of the font in a slot before the slot takes another, freeing it if nothing else holds it.
|
| bool | font_slots_swap (const FontSlots *slots, uint32_t *resources, int id, uint32_t resource, FontSlotLoad load, FontSlotUnload unload) |
| | Swaps a slot's font for another resource, freeing the old one when nothing else holds it.
|
| void | font_slots_unload_all (const FontSlots *slots, FontSlotUnload unload) |
| | Frees every font the app owns, each one once, and empties every slot.
|
The decisions behind the font registry: who owns each slot's font, when a swap has nothing to do, and when a font can be freed.
Lets go of the font in a slot before the slot takes another, freeing it if nothing else holds it.
Only slots the app owns count as holding a font for this. A copy put in as a system font would otherwise keep it alive with nobody left to free it, so ownership moves to the first slot that held it as a system font instead. That slot then frees it like any font the app owns. Registering over that slot afterwards leaves the font it took over loaded, as registering over any owned slot does, so nothing frees it until the face does.
- Parameters
-
| slots | The registry's tables. |
| id | The slot letting go. |
| unload | The call that frees a font. |