ძიება მხარდაჭერაში

ნუ გაებმებით თაღლითების მახეში მხარდაჭერის საიტზე. აქ არასდროს მოგთხოვენ სატელეფონო ნომერზე დარეკვას, შეტყობინების გამოგზავნას ან პირადი მონაცემების გაზიარებას. გთხოვთ, გვაცნობოთ რამე საეჭვოს შემჩნევისას „დარღვევაზე მოხსენების“ მეშვეობით.

ვრცლად

Pdf, custom font displayed as boxes with characters and numbers

  • 13 პასუხი
  • 1 მომხმარებელი წააწყდა მსგავს სიძნელეს
  • 16 ნახვა
  • ბოლოს გამოეხმაურა cor-el

A customer have supplied me with a True Type font containing custom symbols that I use when I generate a PDF.

In Adobe reader, Chrome and IE the symbols are shown correctly. But in Firefox they're shown as boxes with text like: E922 E935 E929


An example PDF can be downloaded here: http://static.opv.se/FirefoxIcons.pdf

The custom font can be found here: http://systembolaget.opv.se/Content/Fonts/systembolaget-icons.ttf


I've tried it with both the normal pdf.js and the dev build-plugin. The problem exists in both of them.

A customer have supplied me with a True Type font containing custom symbols that I use when I generate a PDF. In Adobe reader, Chrome and IE the symbols are shown correctly. But in Firefox they're shown as boxes with text like: E922 E935 E929 An example PDF can be downloaded here: http://static.opv.se/FirefoxIcons.pdf The custom font can be found here: http://systembolaget.opv.se/Content/Fonts/systembolaget-icons.ttf I've tried it with both the normal pdf.js and the dev build-plugin. The problem exists in both of them.
მიმაგრებული ეკრანის სურათები

ჩასწორების თარიღი: , ავტორი: Henric

ყველა პასუხი (13)

Hi   !

Three things come to mind :

1) 3-bar menu => Options => Content => Advanced : check 'Allow pages to choose their own fonts' (and click 'OK')

2) Make sure you have no script blocking add-ons like NoScript that could cause this.

3) Type in the address bar   about:config   (press Enter) (promise to be careful, if asked) Type and look for the preference :

gfx.downlodable_fonts.enabled

and make sure its value is set to   true

Happy112 said

Hi   ! Three things come to mind : 1) 3-bar menu => Options => Content => Advanced : check 'Allow pages to choose their own fonts' (and click 'OK') 2) Make sure you have no script blocking add-ons like NoScript that could cause this. 3) Type in the address bar   about:config   (press Enter) (promise to be careful, if asked) Type and look for the preference : gfx.downlodable_fonts.enabled and make sure its value is set to   true

Thanks for your reply. All 3 points were already set to the correct values.

1. "Allow pages to choose their own fonts" is checked/enabled 2. The only plugins are Firebug and HTML Validator 3. gfx.downlodable_fonts.enabled is set to true

It's not just my machine that have this problem. I've tested it on 4 separate machines in different locations, all with the same problems when viewing the PDF.

ჩასწორების თარიღი: , ავტორი: Henric

This looks like an icon font that doesn't get applied.

I'm not sure whether Firefox supports embedding custom fonts in a PDF file. You can check in the Inspector what font Firefox uses and check the Web Console for error messages.


Can you post a link to a publicly accessible page (i.e. no authentication or signing on required) with this PDF file?

cor-el said

This looks like an icon font that doesn't get applied. I'm not sure whether Firefox supports embedding custom fonts in a PDF file. You can check in the Inspector what font Firefox uses and check the Web Console for error messages.

Can you post a link to a publicly accessible page (i.e. no authentication or signing on required) with this PDF file?

Unfortunately the font inspector doesn't tell the truth about which font is used.

The document almost only uses embedded fonts. For instance, the headline in the image is using a font called "BlockGothicRR-MediumCond.ttf", and is rendered correctly - but in the inspector it says it's Arial, and in the html view it says sans-serif.

In the normal text it uses an embedded font called "Graphik-Regular.ttf", and is rendered correctly - but in the inspector it once again says it's Arial, and in the html view it says sans-serif.

in the case of the boxed numbers, it says "Courier new" in the font inspector and "monospace" in the html view. But in reality it probably uses a font called "systembolaget-icons.ttf"

The console is empty, except for a line that says "PDF b431b6c6c4356b7851aea5e6bdd92eae [1.7 - / -] (PDF.js: 1.7.348)", but that just seems to be a standard log message that it will always output to the console when rendering a PDF


Sorry about the authentication. I've updated the original question with a link that doesn't require authentication: http://static.opv.se/FirefoxIcons.pdf

ჩასწორების თარიღი: , ავტორი: Henric

In 'about:config' would you check the string value of this preference please :

(Type gfx.font_rendering. in the search bar first)

gfx.font_rendering.cleartype_params.force_gdi_classis_for_families

And please take a look at this article :

https://www.ghacks.net/2015/07/21/firefox-41-mozilla-modifies-how-icon-fonts-are-handled-by-the-browser/

Happy112 said

In 'about:config' would you check the string value of this preference please : (Type gfx.font_rendering. in the search bar first) gfx.font_rendering.cleartype_params.force_gdi_classis_for_families And please take a look at this article : https://www.ghacks.net/2015/07/21/firefox-41-mozilla-modifies-how-icon-fonts-are-handled-by-the-browser/

It's set to: gfx.font_rendering.cleartype_params.force_gdi_classic_for_families; Arial,Consolas,Courier New,Microsoft Sans Serif,Segoe UI,Tahoma,Trebuchet MS,Verdana

All settings that affect font downloading are enabled, meaning there are no restrictions what so ever on that front. And I don't know if those settings would affect anything in this case, since the fonts aren't really downloaded. They're already embedded in the PDF

ჩასწორების თარიღი: , ავტორი: Henric

Henric said

It's set to: gfx.font_rendering.cleartype_params.force_gdi_classic_for_families; Arial,Consolas,Courier New,Microsoft Sans Serif,Segoe UI,Tahoma,Trebuchet MS,Verdana

That's the default value.

All settings that affect font downloading are enabled, meaning there are no restrictions what so ever on that front. And I don't know if those settings would affect anything in this case, since the fonts aren't really downloaded. They're already embedded in the PDF

I overlooked the part where you mentioned that they're embedded in the PDF   -   my bad   !

Is that ghacks article helpful in any way  ?

Is that ghacks article helpful in any way  ?

I went through the article and checked up on all the settings - and they were all set to the most "allowing" setting, mening there aren't really any restrictions when it comes to fonts.

So as far as I can see, it's probably not a security issue, but probably some kind of bug. Who knows? it might be that it doesn't support unicode characters at high address ranges? Perhaps it has some kind of bug when it comes to character encoding, so it looks for the characters at the wrong address? Perhaps there's some problem with the font that the other PDF readers can handle, but Firefox can't?

Either way, it's a bit frustrating not being able to see the inner workings, making it difficult to guess what the problem might be.

Quite frankly : By asking you to check the default value of the preference : gfx.font_rendering.cleartype_params.force_gdi_classis_for_families I was hoping that maybe you'd consider changing the font(s) when you're using the built-in PDF reader. But as you mentioned that the fonts are displayed correctly when you use the Adobe reader , stab in the dark, but have you tried this :

3-bar menu => Options => Applications => Portable Document Format (PDF) => 'Preview in Firefox : Click 'Use others ...' and choose 'Adobe Acrobat Reader' (and click 'OK')

Happy112 said

But as you mentioned that the fonts are displayed correctly when you use the Adobe reader , stab in the dark, but have you tried this : 3-bar menu => Options => Applications => Portable Document Format (PDF) => 'Preview in Firefox : Click 'Use others ...' and choose 'Adobe Acrobat Reader' (and click 'OK')

I'm sure it would work. Unfortunately this isn't an option for our client. They don't want to install Adobe reader and configure Firefox on thusands of computers in their network. I can't blame them. After all - a few years ago when Adobe reader was run as a plugin in the browsers on most computers, about 2/3 of all virus infections globally got in through security holes in Adobe reader, Adobe Flash or Java plugins. So the fact that the browsers have their own sandboxed PDF readers now is a really good thing. But Firefox implementation seems to be much more limited than those in IE/Chrome, which causes a bit of a problem in many cases.

As I suspected when I look at that PDF file, there are embedded fonts that Firefox doesn't seem to support and recognize. So I don't know of a way to make this work in Firefox. The Firefox 57 Nightly build also doesn't work.

cor-el said

As I suspected when I look at that PDF file, there are embedded fonts that Firefox doesn't seem to support and recognize.

You're right   -   hence I said :

"By asking you to check the default value of the preference : gfx.font_rendering.cleartype_params.force_gdi_classis_for_families I was hoping that maybe you'd consider changing the font(s) when you're using the built-in PDF reader. "

Either that, or use the Adobe Acrobat Reader, which in this case is no option, unfortunately.

You can consider to file a bug report and attach this PDF file.