Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display Issues with Roboto Font from Materialize in Firefox

I am using Materialize to style some of my web pages. I have noticed that Roboto font does not render correctly in Firefox (v43.0.3), but looks fine in Chrome. Both browsers are downloading the woff2 font file from my server, which this question seems to indicate should be the optimum choice for modern browsers.

Chrome rendering: enter image description here

Firefox rendering: enter image description here

(I realize these low-res screencaps are not the best reproduction, the differences are much more apparent in the actual browsers.)

In the Firefox console, I receive a string of error messages similar to:

downloadable font: GSUB: too large substitute: 65535 (font-family: "Roboto" style:normal weight:normal stretch:normal src index:1)

downloadable font: Layout: Failed to parse lookup subtable 0 (font-family: "Roboto" style:normal weight:normal stretch:normal src index:1)

downloadable font: Layout: Failed to parse lookup subtable 0 (font-family: "Roboto" style:normal weight:normal stretch:normal src index:1)

No complaints from Chrome.

As I am not at all familiar with the intricacies of font rendering, I was hoping that someone with some knowledge in that area might have an idea what the problem is based on the error messages from Firefox.

like image 458
user3351605 Avatar asked Jan 12 '16 18:01

user3351605


People also ask

Is Roboto a display font?

Roboto Bold is the default font in Unreal Engine 4, and in Kodi. Roboto Condensed is used to display Information on European versions of Nintendo Switch packaging, including physical releases of games.

What Microsoft font is similar to Roboto?

Arial, Helvetica, sans-serif.

Is Roboto a default Web font?

Roboto is in Google's signature family of fonts, the default font on Android and Chrome OS, and the recommended font for Google's visual language, Material Design.


2 Answers

I finally had some time available to look into this a bit more, it appears that some of the font files in the materialize repository are defective. I was able to completely resolve this issue simply by replacing the font files in the dist/font/roboto directory with the same files available at roboto-fontface-bower. Just pull from any of the version branches v0.3.0 or better.

Hope this helps anyone else who has been frustrated by this.

like image 157
user3351605 Avatar answered Nov 03 '22 02:11

user3351605


To me it looks like either the woff2 file has wrong offsets to the internal font tables or Firefox reads wrong offsets when parsing the offsets.

The GSUB table mentioned in the error message cannot be the main reason for the rendering problems, because it only defines glyph substitutions (like ligature composition and decomposition, alternative glyphs for the same char code, etc). The table does not contain any rendering information for standard glyphs, so if only that table fails to load, rendering of standard text should not be affected. Details about the GSUB table can be found in Microsoft's OTF specification.

Also, I get another error message when looking at this website: http://gwt-material-demo.herokuapp.com/

Firefox tells me that there is something wrong with the OS/2 table (which contains Windows font metrics). This is a completely different part of the font file, which again indicates that there is something wrong with the font structure or with reading the font structure.

So there are two things you can do:

  1. Do not use the woff2 file.

  2. Notify the Roboto and Firefox developers about the issue and hope that they will find the cause for this bug and fix it.

like image 25
Waruyama Avatar answered Nov 03 '22 00:11

Waruyama