User login

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:

  1. Remove all fonts (corrupted by git line ending changes)

    So something like git rm -r fonts && mkdir fonts

  2. 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).

  3. 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.

Searched words: 
CRLF will be replaced by LF prevent

Comments

Such an easy fix for a

Such an easy fix for a frustrating issue-- thank you! :)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.