Closed Bug 1905623 Opened 4 months ago Closed 4 months ago

ncode.syosetu.com - Opening a PDF in Firefox shows Japanese vertical punctuation errors

Categories

(Firefox :: PDF Viewer, defect, P1)

defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: rbucata, Assigned: calixte)

References

()

Details

(Keywords: webcompat:needs-diagnosis, webcompat:site-report)

User Story

platform:windows,mac,linux,android
impact:significant-visual
configuration:general
affects:all

Attachments

(2 files)

Environment:
Operating system: All Desktop
Firefox version: Firefox 127.0/Firefox 129.0a1

Steps to reproduce:

  1. Open a downloaded PDF file from the site (provided in attachment)
  2. Observe the Japanese punctuation

Expected Behavior:
Japanese punctuation is rendered as expected

Actual Behavior:
Items are misaligned

Notes:

  • Reproduces regardless of the status of ETP
  • Reproduces in Firefox Nightly, Firefox Release
  • Does not reproduce in Chrome

Created from https://github.com/webcompat/web-bugs/issues/138659

Attached file N6090JC.pdf
Summary: ncode.syosetu.com - Opening a PDF in Firefox show Japanese vertical punctuation errors → ncode.syosetu.com - Opening a PDF in Firefox shows Japanese vertical punctuation errors

This seems like a pdf.js bug.

Severity: -- → S3
User Story: (updated)
Component: Site Reports → PDF Viewer
Priority: -- → P2
Product: Web Compatibility → Firefox

The brackets on page 2 are encoded in utf-16 in the pdf and their codes are 0x3010 and 0x3011 and according to:
https://www.compart.com/en/unicode/block/U+3000
they seem to be some chars for the horizontal mode since their counter parts in vertical mode exist (see https://www.compart.com/en/unicode/block/U+FE30), that said my skills in Japanese are close to null.
In either Chrome or Acrobat, they're rendered correctly so it means we should detect the text orientation before drawing on the canvas and switch chars from horizontal mode to vertical if it's required.

Priority: P2 → P3

The used (and missing) font is vertical so in using the mapping:
https://searchfox.org/mozilla-central/rev/cbdfa503a87597b20719aae5f6a1efccd6cb3b7b/gfx/thebes/gfxHarfBuzzShaper.cpp#251-294
we should be able to remap correctly the chars when the font isn't embedded.

Assignee: nobody → cdenizet
Status: NEW → ASSIGNED
Priority: P3 → P1
Duplicate of this bug: 1695816

We are pleased to see that bug 1695816, which had not been considered at the time of our report on PDF files published by Japanese ministries, is on its way to being fixed by this bug.

The table you quoted from gfx/thebes/gfxHarfBuzzShaper.cpp was added in bug 1164835.
However, this table does not fully support the section 5 of UTR #50 (Glyphs Changes for Vertical Orientation).
I am not sure what criteria was used to select the characters to create this table.

We look forward to a more complete implementation of UTR #50 Section 5 to correct this error.

bug 1906308 is filed as a related.

See Also: → 1906308

As far as I can tell this table just contains a mapping for the chars having a unicode in both forms (i.e. horizontal or vertical).
For example \u301C (wave dash) isn't the harfbuzz table because it doesn't have a vertical counterpart in unicode (see https://en.wikipedia.org/wiki/Wave_dash).
As reported in https://github.com/mozilla/pdf.js/issues/18384, there are some other issues I'll try to address asap.
That said, the best thing to do is to embed the fonts in the pdf and use them correctly to have the right form for each glyph.
In the pdf specs it's said that it could have some rendering issues in case the fonts aren't embedded... we're in this case.

No longer depends on: 1906488
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: