Question about fonts and fast loading #6744
Replies: 1 comment
-
Posted at 2024-04-01 by Pologram (I call Posted at 2024-04-01 by @halemmerich I think you hit a case nobody thought about before. At least I did not. "removable" apps are expected to cleanup all changes they did to global state while they are unloaded. In my opinion that includes the loading of fonts.
There are a few possible solutions:
There probably are more ways to get this done but some discussion on this will be needed since will affect global behaviour. Posted at 2024-04-02 by @gfwilliams Yes, that's a tricky one. Generally clock faces load big fonts which aren't used by anything else, so deleting them isn't a big deal. However, when something uses a module, generally we don't try and remove the module from memory - and FontVGA8 is a module ( I think in this case I'd just not delete the font from memory - in the scheme of things it's not going to be using huge amounts of RAM. As mentioned it might be an issue on Bangle.js 1 where memory is tight, but realistically you're probably not developing your app to run on that anyway. Posted at 2024-04-02 by Pologram Thanks, I will simply not delete the module :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2024-04-01 by Pologram
Hello,
I developed a clock face that uses the
VGA8
font.At the beginning I call:
require("FontVGA8").add(Graphics);
.I tried implementing fast loading so in the
remove
handler I call:delete Graphics.prototype.setFontVGA8;
The problem is that I also have a widget that uses the
VGA8
font. Now, even though the widget callsrequire("FontVGA8").add(Graphics);
in the beginning of its own code as well, I get the errorUnknown font VGA8.
Was I supposed to call
delete Graphics.prototype.setFontVGA8;
?Beta Was this translation helpful? Give feedback.
All reactions