[l10n] Remove libraqm workarounds and enforce libraqm dependency#774
[l10n] Remove libraqm workarounds and enforce libraqm dependency#774newtonick merged 2 commits intoSeedSigner:devfrom
Conversation
| if not ImageFont.core.HAVE_RAQM: | ||
| # We can't generate pixel-perfect screenshots that match what gets rendered on | ||
| # the device if we don't have libraqm. | ||
| pytest.fail("libraqm is not installed.") | ||
|
|
There was a problem hiding this comment.
I know I suggested putting this here, but now that I think about it, it probably wouldn't hurt to have this check in the main code.
If the check is in, say, the Controller initialization, then it would cover both use cases: on-device check and when running the screenshot generator.
Or is that overkill? The vast majority of usage will be via a release image which we would already be guaranteeing that it's on board. It would really just be to catch any misconfigured dev setups.
I'm leaning: it's 53% useful to test for it all the time, 47% I dunno if it's necessary.
There was a problem hiding this comment.
I think that once we commit to supporting libraqm everywhere (dev and production), it’s reasonable for the Controller to fail if the dependency isn’t present. After all, it’s a functional requirement. Though, every developer would need to make sure they have it installed locally, and that’s added friction.
But on the other hand, if we rely on libraqm for proper behavior and start removing fallbacks or conditional adjustments from the code, then inconsistent behavior between setups becomes a real problem. In that sense, it does make sense to enforce the check in the Controller even if it’s slightly overkill for release images.
There was a problem hiding this comment.
Ooh... we have a couple of if Settings.HOSTNAME == Settings.SEEDSIGNER_OS: checks. We could isolate the HAVE_RAQM test to just when we're NOT running SeedSigner OS.
Although... if we ever broke libraqm support in SeedSigner OS, a totally generalized check would catch that immediately.
Yeah, okay, never mind: I'd still say the check should run in all environments.
There was a problem hiding this comment.
So... I'm a bit hesitant to modify controller.py, I understand that we should do this check in the configure_instance method. But I'm not sure if we should make the whole application fail because of it.
I guess that's probably not too surprising since the |
|
Pending the one possible change mentioned above, I'm an easy: untested ACK. There are five I would expect every screenshot to now have basically imperceptible differences (e.g. subtle letter spacing within words) or more obvious changes to line breaks due to different spacing calcs. I suppose it is possible that a screen might look worse if it was optimized around the imprecise calcs (e.g. something was off by 2 so we applied a +2 adjustment that is now undesirable). So a careful look at all screenshots is on my TODO list before I can totally consider this ready to merge. |
|
@alvroble I'm having trouble passing the libraqm install check in I've completed the apt install of libraqm-dev and then completely re-compiled/install python3.10. I'm not sure what else to do. Any recommendations? |
|
@newtonick the only constraint is that you must install libraqm-dev before Pillow, but if you recompiled Python after installing libraqm that is fulfilled and I don't know what could be happening... to be sure, is it True or False the output of this command in the Python interpreter? If not, maybe I'd check dependencies, are these packages installed when you install libraqm? |
Very helpful, thank you. I ended up running |
|
ACK and tested to the best of my ability. I also support adding a check to |
Description
This PR implements the clean up of libraqm-related code by removing workarounds and ensuring proper libraqm support is enforced.
Changes Made
Add libraqm in dev build instructions (b24ca4b)
Modified
raspberry_pi_os_build_instructions.mdto include libraqm-dev in the required system packagesChanged the apt install command from:
to:
This ensures Raspberry Pi OS dev environment have the necessary libraqm support.
Remove "libraqm not supported" tweaks (430f0cb)
Cleaned up text measurement workarounds in
components.py:Fixed screenshot generator in
generator.py:test_generate_all.This pull request is categorized as a:
Checklist
pytestand made sure all unit tests pass before sumbitting the PRIf you modified or added functionality/workflow, did you add new unit tests?
I have tested this PR on the following platforms/os:
Bonus track!!
It seems the OP_RETURN problem from #762 gets solved with this modifications, although still with a bigger font size.