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',
|
||||
paths: {
|
||||
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', $);
|
||||
|
@ -15,6 +15,7 @@ define(
|
||||
var ttf2eot = require('ttf/ttf2eot');
|
||||
var ttf2svg = require('ttf/ttf2svg');
|
||||
var bytes2base64 = require('ttf/util/bytes2base64');
|
||||
var deflate = require('deflate');
|
||||
var JSZip = require('JSZip');
|
||||
|
||||
/**
|
||||
@ -31,11 +32,7 @@ define(
|
||||
function font2buffer(ttf, options) {
|
||||
var buffer = null;
|
||||
if (options.type === 'woff') {
|
||||
buffer = ttf2woff(new TTFWriter().write(ttf), {
|
||||
deflate: function(input) {
|
||||
return JSZip.compressions.DEFLATE.compress(input);
|
||||
}
|
||||
});
|
||||
buffer = ttf2woff(new TTFWriter().write(ttf), deflate);
|
||||
}
|
||||
else if (options.type === 'eot') {
|
||||
buffer = ttf2eot(new TTFWriter().write(ttf));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file loader.js
|
||||
* @author mengke01
|
||||
* @date
|
||||
* @date
|
||||
* @description
|
||||
* 加载器
|
||||
*/
|
||||
@ -14,19 +14,18 @@ define(
|
||||
var woff2ttf = require('ttf/woff2ttf');
|
||||
var eot2ttf = require('ttf/eot2ttf');
|
||||
var svg2ttfobject = require('ttf/svg2ttfobject');
|
||||
var inflate = require('inflate');
|
||||
var JSZip = require('JSZip');
|
||||
var loading = require('./loading');
|
||||
|
||||
var woffOptions = {
|
||||
inflate: function(input) {
|
||||
return JSZip.compressions.DEFLATE.uncompress(input);
|
||||
}
|
||||
inflate: inflate.inflate
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 加载sfnt结构字体
|
||||
*
|
||||
*
|
||||
* @param {File} file file对象
|
||||
* @param {Object} options 参数
|
||||
* @param {Object} options.type 文件类型
|
||||
@ -72,7 +71,7 @@ define(
|
||||
|
||||
/**
|
||||
* 加载sfnt结构字体
|
||||
*
|
||||
*
|
||||
* @param {ArrayBuffer} buffer 二进制流
|
||||
* @param {Object} options 参数
|
||||
* @param {Object} options.type 文件类型
|
||||
@ -104,7 +103,7 @@ define(
|
||||
|
||||
/**
|
||||
* 加载svg结构字体
|
||||
*
|
||||
*
|
||||
* @param {File} file file对象
|
||||
* @param {Object} options 参数
|
||||
* @param {Function} options.success 成功回调
|
||||
@ -141,7 +140,7 @@ define(
|
||||
|
||||
/**
|
||||
* 加载svg结构字体
|
||||
*
|
||||
*
|
||||
* @param {File} svg svg文本
|
||||
* @param {Object} options 参数
|
||||
* @param {Function} options.success 成功回调
|
||||
@ -165,7 +164,7 @@ define(
|
||||
|
||||
/**
|
||||
* 加载字体
|
||||
*
|
||||
*
|
||||
* @param {File} file file对象
|
||||
* @param {Object} options 参数
|
||||
* @param {Object} options.type 文件类型
|
||||
@ -198,7 +197,7 @@ define(
|
||||
|
||||
/**
|
||||
* 支持的加载类型
|
||||
*
|
||||
*
|
||||
* @param {string} fileName 文件类型
|
||||
* @return {boolean}
|
||||
*/
|
||||
@ -208,7 +207,7 @@ define(
|
||||
|
||||
/**
|
||||
* 支持的导入类型
|
||||
*
|
||||
*
|
||||
* @param {string} fileName 文件类型
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user