mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.97k stars 9.92k forks source link

PDF.js on Chrome with Win 7 Fails to do Subpixel Anti-Aliasing #5196

Closed speedplane closed 9 years ago

speedplane commented 10 years ago

Continued from #4252.

Subpixel font rendering does not work in Chrome for the tracemonkey document example. In the image below, pdf.js in Chrome renders the document on top and adobe renders it directly below. Notice that there are tiny artifacts in the pdf.js around the fonts (it's hard to tell because of image compression in the screenshot). This becomes more obvious when you zoom in (see image further down).

Zoomed In (pdf.js on top, adobe reader on bottom):

Notice how the image in adobe reader is not just black and white, but is also red and blue. That's the subpixel antialiasing, which makes documents much easier to read.

yurydelendik commented 10 years ago

Can you also file upstream bug at https://code.google.com/p/chromium/issues ?

speedplane commented 10 years ago

It looks like this is the issue exists and more than a few are unhappy with it: https://code.google.com/p/chromium/issues/detail?id=7508

Maybe star the issue to attract some of their attention.

yurydelendik commented 10 years ago

The issue about talks only about drawImage and not related to the text subpixeling

speedplane commented 10 years ago

It's in there, search for the word fillText.

agoode commented 10 years ago

According to http://blogs.adobe.com/webplatform/2014/04/01/new-canvas-features/ this is supported, but you have to do canvas.getContext("2d", {alpha: false}); to get an opaque canvas first.

yurydelendik commented 10 years ago

@agoode thanks. It works for me on chrome http://jsbin.com/bolusaceyufo/2 for mac osx.

Hmm, we had patch for this once https://github.com/mozilla/pdf.js/pull/4556 , but it was reverted due to black flashing on Chrome. Probably somebody can revive this pr.

varghesethomase commented 10 years ago

Can i take up this bug? Is there someone i could get as a mentor?

yurydelendik commented 10 years ago

Sure. I can be a mentor. Look at the PR 4556 and look for reason why it was reject.

varghesethomase commented 10 years ago

Do you mean a solution to the black white flickering in chrome?

yurydelendik commented 10 years ago

Do you mean a solution to the black white flickering in chrome?

Yes. There are time when canvas is added (which is black with alpha:false) and first drawing happens. Possible multiple solutions: a) add canvas when first drawing happens, or b) set background to white (? not sure if possible)

timvandermeij commented 9 years ago

@speedplane Is this still an issue with the latest version of Chrome for you? https://code.google.com/p/chromium/issues/detail?id=7508#c83 indicates that it might work.

speedplane commented 9 years ago

Yup it works now, feel free to close.

Michael Sander michael.sander@gmail.com 607-227-9859

On Thu, Apr 30, 2015 at 5:34 PM, Tim van der Meij notifications@github.com wrote:

@speedplane https://github.com/speedplane Is this still an issue with the latest version of Chrome for you? https://code.google.com/p/chromium/issues/detail?id=7508#c83 indicates that it might work.

— Reply to this email directly or view it on GitHub https://github.com/mozilla/pdf.js/issues/5196#issuecomment-97975296.