add compound glyf

This commit is contained in:
mkwiser
2014-09-25 23:26:55 +08:00
parent 9228694de9
commit d0e96dc855
11 changed files with 228 additions and 120 deletions

View File

@@ -15,6 +15,7 @@ define(
var ajaxBinaryFile = require('common/ajaxBinaryFile');
var setFontface = require('./setFontface');
var glyf2canvas = require('ttf/util/glyf2canvas');
var lang = require('common/lang');
var ttf = null;
@@ -44,15 +45,8 @@ define(
}
function showGlyf(charcode) {
var glyfData = ttf.getCodeGlyf(charcode);
var glyf = {
xMin: glyfData.xMin,
xMax: glyfData.xMax,
yMin: glyfData.yMin,
yMax: glyfData.yMax,
contours: glyfData.contours
};
var glyf = lang.clone(ttf.getCodeGlyf(charcode));
var canvas = $('#glyf-canvas').get(0);

View File

@@ -15,6 +15,9 @@ define(
var ajaxBinaryFile = require('common/ajaxBinaryFile');
var glyf2svg = require('ttf/util/glyf2svg');
var setFontface = require('./setFontface');
var lang = require('common/lang');
var ttf = null;
// 设置字体
@@ -26,7 +29,7 @@ define(
// 查看ttf glyf
function showTTFGlyf(ttfData) {
console.log(ttfData);
ttf = new TTF(ttfData);
var codes = ttf.codes();
@@ -53,11 +56,10 @@ define(
+ '</g>'
+ '</svg>';
var svg = $(tpl);
var glyf = ttf.getCodeGlyf(charcode);
var lang = require('common/lang');
var glyf = lang.clone(ttf.getCodeGlyf(charcode));
// 调整大小
var width = glyf.xMax - glyf.xMin;
var width = glyf.xMax;
var height = glyf.yMax - glyf.yMin;
var scale = 1;