fix woff deflate
This commit is contained in:
parent
c6e5acf1de
commit
02770032bf
2
dep/pako_deflate.min.js
vendored
Normal file
2
dep/pako_deflate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dep/pako_inflate.min.js
vendored
Normal file
2
dep/pako_inflate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -114,7 +114,9 @@
|
|||||||
baseUrl: './src',
|
baseUrl: './src',
|
||||||
paths: {
|
paths: {
|
||||||
utpl: '../dep/utpl.min',
|
utpl: '../dep/utpl.min',
|
||||||
JSZip: '../dep/jszip/jszip'
|
JSZip: '../dep/jszip/jszip.min',
|
||||||
|
inflate: '../dep/pako_inflate.min',
|
||||||
|
deflate: '../dep/pako_deflate.min'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
define('jquery', $);
|
define('jquery', $);
|
||||||
|
@ -15,6 +15,7 @@ define(
|
|||||||
var ttf2eot = require('ttf/ttf2eot');
|
var ttf2eot = require('ttf/ttf2eot');
|
||||||
var ttf2svg = require('ttf/ttf2svg');
|
var ttf2svg = require('ttf/ttf2svg');
|
||||||
var bytes2base64 = require('ttf/util/bytes2base64');
|
var bytes2base64 = require('ttf/util/bytes2base64');
|
||||||
|
var deflate = require('deflate');
|
||||||
var JSZip = require('JSZip');
|
var JSZip = require('JSZip');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,11 +32,7 @@ define(
|
|||||||
function font2buffer(ttf, options) {
|
function font2buffer(ttf, options) {
|
||||||
var buffer = null;
|
var buffer = null;
|
||||||
if (options.type === 'woff') {
|
if (options.type === 'woff') {
|
||||||
buffer = ttf2woff(new TTFWriter().write(ttf), {
|
buffer = ttf2woff(new TTFWriter().write(ttf), deflate);
|
||||||
deflate: function(input) {
|
|
||||||
return JSZip.compressions.DEFLATE.compress(input);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (options.type === 'eot') {
|
else if (options.type === 'eot') {
|
||||||
buffer = ttf2eot(new TTFWriter().write(ttf));
|
buffer = ttf2eot(new TTFWriter().write(ttf));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file loader.js
|
* @file loader.js
|
||||||
* @author mengke01
|
* @author mengke01
|
||||||
* @date
|
* @date
|
||||||
* @description
|
* @description
|
||||||
* 加载器
|
* 加载器
|
||||||
*/
|
*/
|
||||||
@ -14,19 +14,18 @@ define(
|
|||||||
var woff2ttf = require('ttf/woff2ttf');
|
var woff2ttf = require('ttf/woff2ttf');
|
||||||
var eot2ttf = require('ttf/eot2ttf');
|
var eot2ttf = require('ttf/eot2ttf');
|
||||||
var svg2ttfobject = require('ttf/svg2ttfobject');
|
var svg2ttfobject = require('ttf/svg2ttfobject');
|
||||||
|
var inflate = require('inflate');
|
||||||
var JSZip = require('JSZip');
|
var JSZip = require('JSZip');
|
||||||
var loading = require('./loading');
|
var loading = require('./loading');
|
||||||
|
|
||||||
var woffOptions = {
|
var woffOptions = {
|
||||||
inflate: function(input) {
|
inflate: inflate.inflate
|
||||||
return JSZip.compressions.DEFLATE.uncompress(input);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载sfnt结构字体
|
* 加载sfnt结构字体
|
||||||
*
|
*
|
||||||
* @param {File} file file对象
|
* @param {File} file file对象
|
||||||
* @param {Object} options 参数
|
* @param {Object} options 参数
|
||||||
* @param {Object} options.type 文件类型
|
* @param {Object} options.type 文件类型
|
||||||
@ -72,7 +71,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载sfnt结构字体
|
* 加载sfnt结构字体
|
||||||
*
|
*
|
||||||
* @param {ArrayBuffer} buffer 二进制流
|
* @param {ArrayBuffer} buffer 二进制流
|
||||||
* @param {Object} options 参数
|
* @param {Object} options 参数
|
||||||
* @param {Object} options.type 文件类型
|
* @param {Object} options.type 文件类型
|
||||||
@ -104,7 +103,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载svg结构字体
|
* 加载svg结构字体
|
||||||
*
|
*
|
||||||
* @param {File} file file对象
|
* @param {File} file file对象
|
||||||
* @param {Object} options 参数
|
* @param {Object} options 参数
|
||||||
* @param {Function} options.success 成功回调
|
* @param {Function} options.success 成功回调
|
||||||
@ -141,7 +140,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载svg结构字体
|
* 加载svg结构字体
|
||||||
*
|
*
|
||||||
* @param {File} svg svg文本
|
* @param {File} svg svg文本
|
||||||
* @param {Object} options 参数
|
* @param {Object} options 参数
|
||||||
* @param {Function} options.success 成功回调
|
* @param {Function} options.success 成功回调
|
||||||
@ -165,7 +164,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载字体
|
* 加载字体
|
||||||
*
|
*
|
||||||
* @param {File} file file对象
|
* @param {File} file file对象
|
||||||
* @param {Object} options 参数
|
* @param {Object} options 参数
|
||||||
* @param {Object} options.type 文件类型
|
* @param {Object} options.type 文件类型
|
||||||
@ -198,7 +197,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持的加载类型
|
* 支持的加载类型
|
||||||
*
|
*
|
||||||
* @param {string} fileName 文件类型
|
* @param {string} fileName 文件类型
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
@ -208,7 +207,7 @@ define(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持的导入类型
|
* 支持的导入类型
|
||||||
*
|
*
|
||||||
* @param {string} fileName 文件类型
|
* @param {string} fileName 文件类型
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user