spenibus.net
2015-09-15 14:27:36 GMT

Missing canvas text in Firefox

I was setting up a chart with [Chart.js][1] 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][2] Let me quote `Comment 6`: >**Alice0775 White** >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?][3] [1]: http://www.chartjs.org [2]: https://bugzilla.mozilla.org/show_bug.cgi?id=842521 [3]: http://stackoverflow.com/a/32555353/3512867