mozilla / pdf.js

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

Font not displaying (CronosMM) #1381

Closed Moistly closed 10 years ago

Moistly commented 12 years ago

Fonts not displaying - On the first page CronosMM is the font being used

http://dl.dropbox.com/u/20922503/Energy_SRB_ch6(1).pdf

notmasteryet commented 12 years ago

Console output:

Warning: Font MMType1 is not supported 
Warning: Unsupported font type: MMType1
gigaherz commented 12 years ago

Some more info: [13:03:58.737] Warning: Font MMType1 is not supported @ http://dl.dropbox.com/u/20922503/Energy_SRB_ch6(1).pdf?FontInspector:900 [13:04:00.048] Warning: Unsupported font type: MMType1 @ http://dl.dropbox.com/u/20922503/Energy_SRB_ch6(1).pdf?FontInspector:900

EDIT: Whoops I was late ;P

timvandermeij commented 11 years ago

It's even worse:

Warning: AcroForm/XFA is not supported
Warning: Font MMType1 is not supported
Warning: Font MMType1 is not supported
Er is een probleem opgetreden bij het renderen van de pagina.
PDF.js versie 0.8.265 (build 8561d26)
Bericht: this.glyphNameMap is undefined
Stack:
Font_charToGlyph@resource://pdf.js/build/pdf.js:22305
Font_charsToGlyphs@resource://pdf.js/build/pdf.js:22422
CanvasGraphics_showText@resource://pdf.js/build/pdf.js:3896 CanvasGraphics_executeOperatorList@resource://pdf.js/build/pdf.js:3407
next@resource://pdf.js/build/pdf.js:2484
pdfViewcContinueCallback@resource://pdf.js/web/viewer.js:2773
pdfjsWrapper/PDFPageProxy_display/continueWrapper@resource://pdf.js/build/pdf.js:2477 PDFPageProxy_display@resource://pdf.js/build/pdf.js:2492
pageDisplayReadyPromise@resource://pdf.js/build/pdf.js:2398
runHandlers@resource://pdf.js/build/pdf.js:1860
Warning: Unhandled rejection: TypeError: this.glyphNameMap is undefined
Snuffleupagus commented 11 years ago

I can replicate the new errors reported by @timvandermeij.

Using git bisect, this seems to have regressed in PR #3209.

Edit: The failure happens here: https://github.com/mozilla/pdf.js/blob/master/src/fonts.js#L4700. For MMType1 fonts this.glyphNameMap isn't defined, which causes this.glyphNameMap[glyphName] to return an error. I think you could get away with just changing line 4700 from: fontCharCode = this.glyphNameMap[glyphName] || to: fontCharCode = (this.glyphNameMap && this.glyphNameMap[glyphName]) ||.

I don't really know anything about the font rendering in pdf.js, so I assume that this probably is a much to simple solution.

timvandermeij commented 11 years ago

Maybe @yurydelendik can shed some light on this?

yurydelendik commented 11 years ago

Hard to tell that it's a regression since MMType1 is not implemented yet. It would make sense to error at https://github.com/mozilla/pdf.js/blob/master/src/fonts.js#L2500 instead of warn.

timvandermeij commented 11 years ago

There are less errors and warnings now and the document renders, but the header text on the first page is missing. This is the console output left:

PDF a3327f2d43811ddb320112437d4c8 [1.6 Adobe PDF Library 7.0 / Adobe InDesign CS2 (4.0.5)] (PDF.js: 0.8.303)
Warning: AcroForm/XFA is not supported
Warning: Error during font loading: Font MMType1 is not supported
Warning: Error during font loading: Font MMType1 is not supported