From 747709295945279e230250709bb9060455803e4c Mon Sep 17 00:00:00 2001 From: kekee000 Date: Thu, 2 Jul 2015 22:56:38 +0800 Subject: [PATCH] fix size bugs --- src/ttf/table/glyf/write.js | 2 +- src/ttf/table/post.js | 6 +++--- src/ttf/util/compound2simpleglyf.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ttf/table/glyf/write.js b/src/ttf/table/glyf/write.js index 703b4de..76fd899 100644 --- a/src/ttf/table/glyf/write.js +++ b/src/ttf/table/glyf/write.js @@ -73,7 +73,7 @@ define( flags += componentFlag.WE_HAVE_A_TWO_BY_TWO; } else { - if (a !== 1 || d !== 1 && a === d) { + if ((a !== 1 || d !== 1) && a === d) { flags += componentFlag.WE_HAVE_A_SCALE; } else if (a !== 1 || d !== 1) { diff --git a/src/ttf/table/post.js b/src/ttf/table/post.js index 847ddb7..2b17764 100644 --- a/src/ttf/table/post.js +++ b/src/ttf/table/post.js @@ -104,12 +104,12 @@ define( ttf.post.maxMemType1 = numberOfGlyphs; // version 3 不设置post信息 - if (post.format === 3 || post.format === 1) { - return 34; + if (ttf.post.format === 3 || ttf.post.format === 1) { + return 32; } // version 2 - var size = 34 + numberOfGlyphs * 2; // header + numberOfGlyphs * 2 + var size = 34 + numberOfGlyphs * 2; // header + numberOfGlyphs + numberOfGlyphs * 2 var glyphNames = []; var nameIndexArr = []; var nameIndex = 0; diff --git a/src/ttf/util/compound2simpleglyf.js b/src/ttf/util/compound2simpleglyf.js index 018ac85..e2cf70c 100644 --- a/src/ttf/util/compound2simpleglyf.js +++ b/src/ttf/util/compound2simpleglyf.js @@ -28,7 +28,7 @@ define( glyfs.forEach(function (g) { var glyph = ttf.glyf[g.glyphIndex]; - if (!glyph) { + if (!glyph && !glyph.length) { return; }