question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some of the Devnagri Fonts not being rendered properly

See original GitHub issue

Link to PDF file: 2007-01-SB_CMYK.pdf

Configuration:

  • Web browser and its version: Chrome (Version 51.0.2704.103 m) and Mozilla Firefox 47.0
  • Operating system and its version: Windows 10 Pro
  • PDF.js version: 1.5.355
  • Is an extension: N/A

Steps to reproduce the problem:

  1. Go to https://mozilla.github.io/pdf.js/web/viewer.html
  2. Upload the attached PDF (2007-01-SB_CMYK.pdf) file to reproduce the error.

What is the expected behavior? I have attached correct display of the PDF file below which is showing up the text without any issue before being rendered by pdf.js before-being-rendered

What went wrong? Some of the text are not being rendered properly. We are using SHREE-DEV Devnagri Fonts which are freely available at http://www.abstractfonts.com/search/shree-dev-0714 download for download. I have included the screenshot of the PDF file which is being rendered incorrectly. fonts-issue-01

Chrome Error Console Output:

Warning: Failed to load font "g_d0_f2": SyntaxError: Invalid font data in ArrayBuffer. pdf.js:277
Warning: Failed to load font "g_d0_f4": SyntaxError: Invalid font data in ArrayBuffer. pdf.js:277
Warning: Failed to load font "g_d0_f6": SyntaxError: Invalid font data in ArrayBuffer. pdf.js:277
Warning: Failed to load font "g_d0_f10": SyntaxError: Invalid font data in ArrayBuffer. pdf.js:277
Warning: Failed to load font "g_d0_f11": SyntaxError: Invalid font data in ArrayBuffer. pdf.js:277

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Snuffleupaguscommented, Jul 26, 2016

A more complete error message, from the Firefox console:

PDF 94eb7faf31644e43a33f25c9d8e3b37b [1.7 Adobe PDF Library 10.0.1 / Adobe InDesign CS6 (Windows)] (PDF.js: 1.5.355)viewer.js:7880:7
downloadable font: glyf: Bytecode length too high 135 (font-family: "g_d0_f2" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: glyf: Failed to parse glyph 19 (font-family: "g_d0_f2" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: rejected by sanitizer (font-family: "g_d0_f2" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: font load failed (font-family: "g_d0_f2" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
Warning: Failed to load font ""g_d0_f2"": SyntaxError: An invalid or illegal string was specifiedpdf.js:277:5
downloadable font: glyf: Bytecode length too high 166 (font-family: "g_d0_f4" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: glyf: Failed to parse glyph 36 (font-family: "g_d0_f4" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: rejected by sanitizer (font-family: "g_d0_f4" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: font load failed (font-family: "g_d0_f4" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
Warning: Failed to load font ""g_d0_f4"": SyntaxError: An invalid or illegal string was specifiedpdf.js:277:5
downloadable font: glyf: Bytecode length too high 158 (font-family: "g_d0_f6" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: glyf: Failed to parse glyph 36 (font-family: "g_d0_f6" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: rejected by sanitizer (font-family: "g_d0_f6" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: font load failed (font-family: "g_d0_f6" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
Warning: Failed to load font ""g_d0_f6"": SyntaxError: An invalid or illegal string was specifiedpdf.js:277:5
downloadable font: glyf: Bytecode length too high 123 (font-family: "g_d0_f10" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: glyf: Failed to parse glyph 20 (font-family: "g_d0_f10" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: rejected by sanitizer (font-family: "g_d0_f10" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: font load failed (font-family: "g_d0_f10" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
Warning: Failed to load font ""g_d0_f10"": SyntaxError: An invalid or illegal string was specifiedpdf.js:277:5
downloadable font: glyf: Bytecode length too high 182 (font-family: "g_d0_f11" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: glyf: Failed to parse glyph 45 (font-family: "g_d0_f11" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: rejected by sanitizer (font-family: "g_d0_f11" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
downloadable font: font load failed (font-family: "g_d0_f11" style:normal weight:normal stretch:normal src index:0) source: (invalid URI)(unknown)
Warning: Failed to load font ""g_d0_f11"": SyntaxError: An invalid or illegal string was specifiedpdf.js:277:5

The errors thus point to the glyf data validation in OTS, in particular src/glyf.cc#L101-L108.

Interestingly, if we called sanitizeGlyphLocations with hintsValid = false, see src/core/fonts.js#L1644-L1646, this would just fix things. I’m wondering if sanitizeTTPrograms, see src/core/fonts.js#L2084, is somehow failing to detect that the fonts aren’t well formed!?

0reactions
ash-recommindcommented, Sep 28, 2017

Done: Created ticket #8960

Read more comments on GitHub >

github_iconTop Results From Across the Web

Devanagari font not rendered correctly · Issue #3191 - GitHub
I am trying to print Devanagari text on the image. The text is printing on the image. But, it is not appearing the...
Read more >
Incorrect rendering/display of Devanagari fonts in browsers
To render any language text, font should support that text. Default fonts of Ubuntu does not render Devanagari correctly. In order to correctly...
Read more >
Emacs 27.2 not rendering Devanagari fonts properly
I am having problems with Devanagari fonts in Emacs 27.2. I am using the Noto Sans Devanagari font to render the devanagari unicode...
Read more >
Unicode font rendering broken with Devanagari fonts?
Hi there, I am very interested in rendering Unicode text involving Devanagari characters (used for languages like Hindi, Sanskrit, etc.).
Read more >
Devanagari ( Indian ) fonts are not being rendered by browsers
Check database setting for UTF-8 for other languages. · Yes, I've already set Database Character set to AL32UTF · You have to make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found