-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[background image] Clean up unused background images from .ufo and .fontra #1813
Comments
Here some ideas: 1: I am wondering if we could have something like a 2: When deleting the image a dialog could pop up with the question if you want to "delete forever" the image, no undo possible. 3 (only possible for Fontra Pak): Closing the app triggers a script which deletes the removed images. Not sure how this idea would work with Fontra running on a server. |
Another idea: Fontra has somewhere a temporary folder, right? We could move the image to the temporary folder when removed and with undo we could get it back from the temporary folder. I expect that this temporary folder will be deleted some day, am I right? |
One complication (at least in UFO) is that background images can be reused in multiple glyphs. Perhaps designspace/ufo need a different approach from Fontra (where so far the concept is to never reuse images). The "delayed" delete approach is what I was thinking of. But the temporary folder idea sounds usable. (Fontra doesn't have a dedicated temp folder, but we can make temp folders easily.) |
The approach I'm not most seriously considering is pretty much: let the backend do garbage collecting. The backend keeps track of which image files are actually used, and will put aside the unused images in a temp folder, so they can be "revived" in case undo/redo causes them to be referenced again. Unreferenced images could be deleted permanently:
Practically, the GlyphDependencies class can be used to track the glyph <-> images relationships. And the initial dependencies could be read in the background once the backend starts up, just like how component references are read. Once we pick this up, I suggest to first implement it for .fontra, and only tackle .ufo after that, as it's more complex. The .fontra implementation may be simpler, as it is not possible (by design) to reuse a single image in multiple layers/glyphs. |
Currently, background image data is never deleted, even if they are no longer referenced by any glyphs.
We need to determine a scheme when to delete the underlying image data. This is somewhat tricky, as the image data does not participate in undo and change objects.
This needs to be implemented both for the .designspace backend and for the .fontra backend.
The text was updated successfully, but these errors were encountered: