1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00
pdf.js/src/core
Jonas Jenwald 2e9cd3ea64 Slightly refactor the fontRef handling in PartialEvaluator_loadFont (issue 7403 and issue 7402)
Originally, I was just going to change this code to use `Ref_toString` in a couple more places. When I started reading the code, I figured that it wouldn't hurt to clean up a couple of comments. While doing this, I noticed that the logic for the (rare) `isDict(fontRef)` case could do with a few improvements.

There should be no functional changes with this patch, but given the added reference checks, we will now avoid bogus `Ref`s when resolving font aliases. In practice, as issue 7403 shows, the current code can break certain PDF files even if it's very rare.

Note that the only thing that this patch will change, is the `font.loadedName` in the case where a `fontRef` is a reference *and* the font doesn't have a descriptor. Previously for `fontRef = Ref(4, 0)` we'd get `font.loadedName = 'g_d0_f4_0'`, and with this patch `font.loadedName = g_d0_f4R`, which is actually one character shorted in most cases. (Given that `Ref_toString` contains an optimization for the `gen === 0` case, which is by far the most common `gen` value.)

In the already existing fallback case, where the `fontName` is used to when creating the `font.loadedName`, we allow any alphanumeric character. Hence I don't see how (as mentioned above) e.g. `font.loadedName = g_d0_f4R` would be an issue here.
2016-07-21 16:03:33 +02:00
..
annotation.js Expose the text widget's maximum length. 2016-06-29 17:04:33 +08:00
arithmetic_decoder.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
bidi.js Fixes weird loop in the bidi.js. 2016-04-27 16:14:33 -05:00
cff_parser.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
charsets.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
chunked_stream.js Remove unused variables 2016-05-11 16:11:13 +02:00
cmap.js Catch errors and continue parsing in parseCMap (issue 7492) 2016-07-18 16:39:56 +02:00
colorspace.js Use Dict_getArray in more places in src/core/ to avoid issues when Arrays contain indirect objects 2016-05-05 19:42:57 +02:00
crypto.js Fixes some static analysis warnings and recommendations 2016-05-02 17:34:58 -05:00
document.js Move the isSpace utility function from core/parser.js to shared/util.js 2016-06-06 09:11:33 +02:00
encodings.js Refactor Encodings 2016-01-28 11:32:59 -06:00
evaluator.js Slightly refactor the fontRef handling in PartialEvaluator_loadFont (issue 7403 and issue 7402) 2016-07-21 16:03:33 +02:00
font_renderer.js Extract CFFParser from fonts.js (issue 6777) 2016-04-01 22:32:39 +02:00
fonts.js Merge pull request #7490 from Snuffleupagus/issue-7426 2016-07-21 14:39:19 +02:00
function.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
glyphlist.js Lazify GlyphsUnicode. 2016-01-28 11:32:59 -06:00
image.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
jbig2.js Remove unused variables 2015-12-16 23:52:16 +01:00
jpg.js Update JpegImage.getData to support forceRGBoutput for images with numComponents === 1 (issue 6066) 2016-02-18 10:12:37 +01:00
jpx.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
metrics.js Lazify Metrics 2016-01-28 12:11:46 -06:00
murmurhash3.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
network.js Makes PDF data reading Streams API friendly. 2016-02-18 13:17:53 -06:00
obj.js [api-minor] Let Catalog_getPageIndex check that the Ref actually points to a /Page dictionary 2016-05-21 14:13:41 +02:00
parser.js trivial spelling fixes 2016-07-17 14:33:41 +02:00
pattern.js Use Dict_getArray in more places in src/core/ to avoid issues when Arrays contain indirect objects 2016-05-05 19:42:57 +02:00
pdf_manager.js Removes global PDFJS usage from the src/core/. 2016-03-23 19:24:37 -05:00
primitives.js [api-minor] Let Catalog_getPageIndex check that the Ref actually points to a /Page dictionary 2016-05-21 14:13:41 +02:00
ps_parser.js Move the isSpace utility function from core/parser.js to shared/util.js 2016-06-06 09:11:33 +02:00
standard_fonts.js Lazify stdFontMap, serifFonts, GlyphMapForStandardFonts 2016-01-28 11:51:54 -06:00
stream.js Move the isSpace utility function from core/parser.js to shared/util.js 2016-06-06 09:11:33 +02:00
type1_parser.js Move the isSpace utility function from core/parser.js to shared/util.js 2016-06-06 09:11:33 +02:00
unicode.js Convert uniXXXX glyph names to proper ones when building the charCodeToGlyphId map for TrueType fonts (bug 1132849, issue 6893, issue 6894) 2016-03-09 19:37:15 +01:00
worker.js Proxy global PDFJS.verbosity to properly configure shared/util. 2016-03-23 19:24:37 -05:00