Open Bug 1692746 Opened 5 years ago Updated 4 months ago

PDF.js renders randomly in bold and normal fonts

Categories

(Firefox :: PDF Viewer, defect, P3)

Desktop
Windows 10
defect

Tracking

()

Tracking Status
firefox87 --- affected

People

(Reporter: alice0775, Unassigned)

Details

(Whiteboard: [pdfjs-rendering][pdf-d-font-windows])

Attachments

(1 file)

Attached image image.png —

This is a not recent regression. I can also reproduce the problem on Firefox24.

Steps to reproduce:

  1. Open https://www.sanplatec.co.jp/uploads/files/chemical-resistance/pla_busseihyou.pdf
  2. Zoom in 170% and more

Actual results:
PDF.js renders randomly in bold and normal fonts.
See attached screenshot

This might be a platform issue. I don't see any obvious boldness on Linux.

Severity: -- → S3
Whiteboard: [pdfjs-c-rendering][pdf-d-font-windows]

confirming with Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0

Whiteboard: [pdfjs-c-rendering][pdf-d-font-windows] → [pdfjs-rendering][pdf-d-font-windows]

Alice or Kenan, are you still able to reproduce this?

Flags: needinfo?(kenan.bromann)
Flags: needinfo?(alice0775)

I can reproduce this on Nightly115.0a1 Windows10.

Flags: needinfo?(alice0775)

Strange, I can't reproduce the issue with the last nightly but I can with release.
This pdf doesn't embed any fonts so the rendering depends on the the OS fonts and we recently changed the way to select the fonts to use when there aren't embed.

Redirect a needinfo that is pending on an inactive user to the triage owner.
:calixte, since the bug has recent activity, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(kenan.bromann) → needinfo?(cdenizet)
Flags: needinfo?(cdenizet)
Priority: -- → P3

The font used on my system (Windows 11) for rendering bold/unbold glyphs is MS-PGothic.
It looks a way more consistent with gfx.font_rendering.cleartype_params.rendering_mode set to 5 (DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC).

Jonathan, would it make sense to set rendering_mode to 5 when rendering a pdf (if it's something possible of course) ? Are there any possible drawbacks ?

Flags: needinfo?(jfkthame)

Yes, that would probably be good -- it may result in somewhat less "crisp" rendering in some cases, but should generally be more consistent. But I'm not sure there's currently any mechanism to do this.

I guess we'd need to either provide an API that pdfjs can use to control the mode, or the graphics backend would somehow need to be able to detect that it's rendering pdfjs content.

Or we could perhaps decide that canvas2d on Windows should always use mode 5. But people might object to a mismatch between canvas2d and DOM text modes, so I'm wary of that option.

Flags: needinfo?(jfkthame)

Maybe we could have something similar to the css property text-rendering but for the canvas context and when it's set to geometricPrecision we could use whatever (depending on the platform) makes the rendering "better".

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: