mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-13 07:48:30 +00:00
default system font can be statically changed by modifying the SYSTEM_STYLE constant. This of course will lead to a request for a dynamically configurable preference for font size. However, early on it was decided this is a bad idea. Here's why. We don't provide for dynamic system-wide font selection because this adds a lot of complexity to what would otherwise be static code: this is a deliberate choice to improve code density and performance. If the system font were dynamically adjustable, then every character rendered we would potentially have to query the PDDB for the current system font setting. The impact of this could be mitigated by caching values but then what happens when you actually change the font? now you need a registry to fire messages off to all dependent crates with cached values to flush their caches and redraw (or you punt and force a reboot if you change font sizes, but still, you're creating a dependency on a lot of plumbing for even the simplest crates). Plus, with a static font selection, the compiler can take constants like the font height and compose them with other fitting parameters into optimized load/stores of borders and spacings for the static case; if you make it dynamic, all those multiplies, adds and divides now get pulled into the main rendering loop and are recomputed all the time. For example, if you have a static const list of items that need to be rendered, even if the code to compute the height of the list is written as a for loop, the compiler will know the list is constant, and the font height is constant, and it can condense that all into a single number at compile time, eliminating all the code for the for loop. If you leave the option open to change that, that entire piece of code has to be generated and executed even though in practice nobody changes the parameter. |
||
|---|---|---|
| .. | ||
| cmds | ||
| cmds.rs | ||
| main.rs | ||
| nettests.rs | ||
| oqc_test.rs | ||