Is Git corrupting your font files?
I was getting errors like this in the console:
downloadable font: incorrect file size in WOFF header (font-family: "Graphik" style:normal weight:bold stretch:normal src index:1) source: ... themes/butaro/fonts/Graphik-Bold-Web.woff
downloadable font: rejected by sanitizer (font-family: "Graphik" style:normal weight:bold stretch:normal src index:1) source: ... themes/butaro/fonts/Graphik-Bold-Web.woff
Git would have given you warnings that look like this when you git added the fonts:
"warning: CRLF will be replaced by LF in Graphik-Bold-Web.woff"
Here's the solution:
- Remove all fonts (corrupted by git line ending changes)
So something like
git rm -r fonts && mkdir fonts
- Add additional font files to the do-not-munge list.
In the .gitattributes that comes with Drupal, add:
*.eot -text diff *.woff -text diff
This is because Drupal is *instructing* git to mess around with your files. See Relax .gitattributes global rule (a core issue still open as of 2016 May).
- Add the fonts again, git add them, and commit them— make sure no warnings this time.
Note: Adding these lines to .gitattributes above Drupal's in the repository will not work. Drupal's overrides. Playing around with autocrlf and safescrlf and eol settings in Git is not what you want either. Just that, above.
Comments
Such an easy fix for a
Such an easy fix for a frustrating issue-- thank you! :)
Post new comment