firenvim icon indicating copy to clipboard operation
firenvim copied to clipboard

New renderer unable to set text color with certain fonts

Open dlobue opened this issue 3 years ago • 3 comments

  • OS Version: mac x86-64
  • Browser Version: Firefox 91.0
  • Browser Addon Version: 0.2.8
  • Neovim Plugin Version: 0.2.8

Since the new renderer was released all text in firenvim's frame has been black (which is problematic due to the dark background of the frame). I could see the text with a white background, but that hurts my eyes.

I tried many different color schemes, but none would change the text color.

I finally read the troubleshooting doc today, and completely bypassed my init.vim, and color came back! Turns out the font I was using, Source Code Pro, was the issue. I switched fonts to Fira Code and things work now, but I thought I'd make the report anyway.

As I mentioned this all happened when the new renderer was released, because I was using this same font and vim setup earlier this year when I submitted that fix for jenkins.

I can provide screenshots or other info to help debug if necessary.

What I tried to do

:set guifont=Source\ Code\ Pro:h22

What happened

All text in firenvim frame is black.

dlobue avatar Sep 10 '21 22:09 dlobue

This sounds either like a bug in your font or a bug in firefox. Can you reproduce when saving the following page to your disk and opening it in your browser?

<!doctype html>
<html>
  <head>
    <meta charset="utf-8"/>
    <script>
      window.addEventListener("load", (e) => {
        const canvas = document.getElementById("canvas");
        const context = canvas.getContext("2d");
        context.font = "22pt Source Code Pro";
        const { width, actualBoundingBoxAscent, actualBoundingBoxDescent } = context.measureText("A");
        const height = Math.abs(actualBoundingBoxAscent) + Math.abs(actualBoundingBoxDescent);
        context.fillStyle = "#000000";
        context.fillRect(0, 0, width, height);
        context.fillStyle = "#FF0000";
        context.fillText("A", 0, height, width, height * 2);
        const data = context.getImageData(0, 0, width, height)
        context.putImageData(data, width, 0);
      });
    </script>
  </head>
  <body>
    <canvas id="canvas"></canvas>
  </body>
</html>

This renders two As red on black, but if the bug is present you shouldn't see them.

glacambre avatar Sep 11 '21 06:09 glacambre

firenvim-test

This is happening on a mac, btw. Works just fine on linux :/

dlobue avatar Sep 13 '21 17:09 dlobue

Great, thanks for trying it out. Could you open a bug on https://bugzilla.mozilla.org/home and post a link to it here? Hopefully the tiny reducer and screenshots you've made will be enough to convince Mozilla that there is a bug.

glacambre avatar Sep 13 '21 17:09 glacambre