Commit aad70834 authored by herom's avatar herom Committed by Chris Rebert

Fixes #9925: convert font data to base64, fixing 0xefbfbd (Unicode Replacement...

Fixes #9925: convert font data to base64, fixing 0xefbfbd (Unicode Replacement Character) chars in customizer fonts.

Merges #9982
parent 58a47b6b
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module.exports = function(grunt) { module.exports = function(grunt) {
"use strict"; "use strict";
var btoa = require('btoa')
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
...@@ -209,7 +210,8 @@ module.exports = function(grunt) { ...@@ -209,7 +210,8 @@ module.exports = function(grunt) {
return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path) return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path)
}) })
.forEach(function (path) { .forEach(function (path) {
return files[path] = fs.readFileSync(type + '/' + path, 'utf8') return type == 'fonts' ? files[path] = btoa(fs.readFileSync(type + '/' + path)) :
files[path] = fs.readFileSync(type + '/' + path, 'utf8')
}) })
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n' return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'
} }
......
...@@ -129,7 +129,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -129,7 +129,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (fonts) { if (fonts) {
var fontsFolder = zip.folder('fonts') var fontsFolder = zip.folder('fonts')
for (var fileName in fonts) { for (var fileName in fonts) {
fontsFolder.file(fileName, fonts[fileName]) fontsFolder.file(fileName, fonts[fileName], {base64: true})
} }
} }
......
This diff is collapsed.
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
} }
] ]
, "devDependencies": { , "devDependencies": {
"grunt": "~0.4.1" "btoa": "~1.1.1"
, "grunt": "~0.4.1"
, "grunt-contrib-clean": "~0.5.0" , "grunt-contrib-clean": "~0.5.0"
, "grunt-contrib-concat": "~0.3.0" , "grunt-contrib-concat": "~0.3.0"
, "grunt-contrib-connect": "~0.5.0" , "grunt-contrib-connect": "~0.5.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment