dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: plugin API - font_unload

plugin API - font_unload

From: Karl Koehler <>
Date: Sat, 11 Dec 2010 12:14:16 -0800


I'm just getting started with plugin development; and I already seem
to have some questions regarding the font API.
Namely, if I load a non-system font with

   struct font* font = (struct font*)malloc(sizeof(struct font));
   int fontId = rb->font_load(font, name);


then at the end, I feel I should be able to do

Now font_load doesn't know if the font was malloc'd or just a stack
variable in plugin_start, thus the system can not free the memory.
But if I just free the memory, then the slot will remain taken,
leading to a resource leak.
And possible crashes if another plugin want to use the same slot when
it's font-loading fails.

I see that rockpaint does only one font at a time, loading each to the
default slot, which seems wasteful in terms of CPU resources - it
doesn't seem right to load/unload all the time.
Do we have a way to unload fonts in the plugin-API ? ( I see there is
an API in firmware/export/font.h , but surely I should not be mucking
with this directly ?


  - Karl
Received on 2010-12-11

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy