I was setting up a chart with [Chart.js] and for some reason, the text was not visible while everything else rendered just fine.
After searching a bit, it turned out that because I disabled hardware acceleration in Firefox, the pref `gfx.direct2d.disabled` had been set to `true`. Toggling it to `false` made canvas text available.
Except it also made fonts look worse in webpages and `view-source`. Searching for an alternative, I stumbled upon this:
[Bug 842521 - PDF.js won't render text when DirectWrite is enabled with both Skia and Cairo backends]
Let me quote `Comment 6`:
>2013-02-19 06:51:15 PST
>Anyway, in this case ,setting gfx.canvas.azure.backends = cairo helps.
This behavior is introduced by Bug 831525.
So I set:
- `gfx.direct2d.disabled` back to `false`
- `gfx.canvas.azure.backends` to `cairo`
And canvas text was then visible while not visibly affecting font rendering in webpages.
I also posted this solution in a likely off-topic question on StackOverflow:
[How to enable HTML5 canvas text in Firefox?]