Repository navigation
Only set the Glyph.prototype.originalCharCode property when debugging - #22350
Snuffleupagus merged 1 commit into
Conversation
This property was added in PR 13494 specifically for the debugger, however it wasn't actually used anywhere else. More recently PR 20334 started using that property in `getTextContent`, however it's not clear to me that doing so was necessarily correct. First of all, note that `Glyph` instances already contain an `isSpace` property. Secondly, and more importantly, using the "raw" charCode may be wrong in composite fonts with multi-byte strings. Note how the `isSpace` property is determined in the PDF.js code: https://github.com/mozilla/pdf.js/blob/8e62d2475645a9a625b3e98964fc241d3f9c144f/src/core/fonts.js#L3721-L3732 which is based on [the following specification text](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#page=253): > Word spacing shall be applied to every occurrence of the single-byte character code 32 in a string when using a simple font or a composite font that defines code 32 as a single-byte code. It shall not apply to occurrences of the byte value 32 in multiple-byte codes.
Reference testsResults for 7b0a38d (run, references from mozilla/pdf.js.refs@b11d8aa217).
The report is kept for 30 days and replaced by the next run. |
Viewer preview🗑️ Viewer previews removed. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22350 +/- ##
==========================================
- Coverage 90.59% 90.58% -0.01%
==========================================
Files 278 278
Lines 68535 68536 +1
==========================================
- Hits 62088 62085 -3
- Misses 6447 6451 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Comparing Footnotes
|


This property was added in PR #13494 specifically for the debugger, however it wasn't actually used anywhere else.
More recently PR #20334 started using that property in
getTextContent, however it's not clear to me that doing so was necessarily correct. First of all, note thatGlyphinstances already contain anisSpaceproperty. Secondly, and more importantly, using the "raw" charCode may be wrong in composite fonts with multi-byte strings.Note how the
isSpaceproperty is determined in the PDF.js code:pdf.js/src/core/fonts.js
Lines 3721 to 3732 in 8e62d24