Hi,

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
  rb->font_unload(fontId)

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 ?

Thanks,

 - Karl

Reply via email to