From 7750a1036cd866bad6891feafa1a9ea57e5259db Mon Sep 17 00:00:00 2001 From: kekee000 Date: Tue, 14 Apr 2015 00:18:15 +0800 Subject: [PATCH] fix empty ttf template --- demo/sync/example-ascii.html | 292 +++++++++++++++++++ demo/sync/example.html | 529 ++++++++++++++++++----------------- demo/sync/icon.css | 171 +---------- demo/sync/page.css | 1 + src/ttf/data/default.js | 2 +- src/ttf/data/empty.js | 21 +- src/ttf/getEmptyttfObject.js | 1 + src/ttf/table/OS2.js | 2 +- 8 files changed, 589 insertions(+), 430 deletions(-) create mode 100644 demo/sync/example-ascii.html diff --git a/demo/sync/example-ascii.html b/demo/sync/example-ascii.html new file mode 100644 index 0000000..8de2249 --- /dev/null +++ b/demo/sync/example-ascii.html @@ -0,0 +1,292 @@ + + + + + icon example + + + + +
+

预览字体

+ + +
第一步:使用font-face声明字体 +
+@font-face {
+    font-family: 'fonteditor';
+    src: url('fonteditor.eot'); /* IE9*/
+    src: url('fonteditor.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
+    url('fonteditor.woff') format('woff'), /* chrome、firefox */
+    url('fonteditor.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
+    url('fonteditor.svg#uxfonteditor') format('svg'); /* iOS 4.1- */
+}
+
+第二步:定义使用fonteditor的样式 +
+.fonteditor {
+    font-family:"fonteditor" !important;
+    font-size:16px;font-style:normal;
+    -webkit-font-smoothing: antialiased;
+    -webkit-text-stroke-width: 0.2px;
+    -moz-osx-font-smoothing: grayscale;
+}
+
+第三步:挑选相应图标并获取字体编码,应用于页面 +
+    <i class="fonteditor">&#x33</i>
+
+
+
+ + + + diff --git a/demo/sync/example.html b/demo/sync/example.html index b8dc102..5b2bfc1 100644 --- a/demo/sync/example.html +++ b/demo/sync/example.html @@ -8,257 +8,284 @@
-

fonteditor example

- -
+

预览字体

+ +
第一步:使用font-face声明字体 +
+@font-face {
+    font-family: 'fonteditor';
+    src: url('fonteditor.eot'); /* IE9*/
+    src: url('fonteditor.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
+    url('fonteditor.woff') format('woff'), /* chrome、firefox */
+    url('fonteditor.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
+    url('fonteditor.svg#uxfonteditor') format('svg'); /* iOS 4.1- */
+}
+
+第二步:定义使用fonteditor的样式 +
+.fonteditor {
+    font-family:"fonteditor" !important;
+    font-size:16px;font-style:normal;
+    -webkit-font-smoothing: antialiased;
+    -webkit-text-stroke-width: 0.2px;
+    -moz-osx-font-smoothing: grayscale;
+}
+
+第三步:挑选相应图标并获取字体编码,应用于页面 +
+    <i class="fonteditor">&#x33</i>
+
+
+ + diff --git a/demo/sync/icon.css b/demo/sync/icon.css index cc4fbe1..392f032 100644 --- a/demo/sync/icon.css +++ b/demo/sync/icon.css @@ -11,8 +11,7 @@ url("fonteditor.svg#uxfonteditor") format("svg"); /* iOS 4.1- */ } -[class^="icon-"], -[class*=" icon-"]:after { +.icon { font-family: "fonteditor"; speak: none; font-style: normal; @@ -23,171 +22,3 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - - -.icon-uniE001:before { - content: "\e001"; -} - -.icon-uniE002:before { - content: "\e002"; -} - -.icon-uniE003:before { - content: "\e003"; -} - -.icon-uniE004:before { - content: "\e004"; -} - -.icon-uniE005:before { - content: "\e005"; -} - -.icon-uniE006:before { - content: "\e006"; -} - -.icon-uniE007:before { - content: "\e007"; -} - -.icon-uniE008:before { - content: "\e008"; -} - -.icon-uniE009:before { - content: "\e009"; -} - -.icon-uniE00A:before { - content: "\e00a"; -} - -.icon-uniE00B:before { - content: "\e00b"; -} - -.icon-uniE00C:before { - content: "\e00c"; -} - -.icon-uniE00D:before { - content: "\e00d"; -} - -.icon-uniE00E:before { - content: "\e00e"; -} - -.icon-uniE00F:before { - content: "\e00f"; -} - -.icon-uniE010:before { - content: "\e010"; -} - -.icon-uniE011:before { - content: "\e011"; -} - -.icon-uniE012:before { - content: "\e012"; -} - -.icon-uniE013:before { - content: "\e013"; -} - -.icon-uniE014:before { - content: "\e014"; -} - -.icon-uniE015:before { - content: "\e015"; -} - -.icon-uniE016:before { - content: "\e016"; -} - -.icon-uniE017:before { - content: "\e017"; -} - -.icon-uniE018:before { - content: "\e018"; -} - -.icon-uniE019:before { - content: "\e019"; -} - -.icon-uniE01A:before { - content: "\e01a"; -} - -.icon-uniE01B:before { - content: "\e01b"; -} - -.icon-uniE01C:before { - content: "\e01c"; -} - -.icon-uniE01D:before { - content: "\e01d"; -} - -.icon-uniE01E:before { - content: "\e01e"; -} - -.icon-uniE01F:before { - content: "\e01f"; -} - -.icon-uniE020:before { - content: "\e020"; -} - -.icon-uniE021:before { - content: "\e021"; -} - -.icon-uniE022:before { - content: "\e022"; -} - -.icon-uniE023:before { - content: "\e023"; -} - -.icon-uniE024:before { - content: "\e024"; -} - -.icon-uniE025:before { - content: "\e025"; -} - -.icon-uniE026:before { - content: "\e026"; -} - -.icon-uniE027:before { - content: "\e027"; -} - -.icon-uniE028:before { - content: "\e028"; -} - -.icon-uniE029:before { - content: "\e029"; -} - - - diff --git a/demo/sync/page.css b/demo/sync/page.css index 14cf29e..8acf96f 100644 --- a/demo/sync/page.css +++ b/demo/sync/page.css @@ -111,6 +111,7 @@ table { } .icon-list { overflow: hidden; + *zoom: 1; } .icon-list li { float: left; diff --git a/src/ttf/data/default.js b/src/ttf/data/default.js index de92850..6a136da 100644 --- a/src/ttf/data/default.js +++ b/src/ttf/data/default.js @@ -18,7 +18,7 @@ define( fontFamily: 'fonteditor', fontSubFamily: 'Medium', uniqueSubFamily: 'FontEditor 1.0 : fonteditor', - version: 'Version 1.0 ; FontEditor (v0.0.1) -l 8 -r 50 -G 200 -x 14 -w \"G\" -f -s', + version: 'Version 1.0; FontEditor (v1.0)', postScriptName: 'fonteditor' } }; diff --git a/src/ttf/data/empty.js b/src/ttf/data/empty.js index 43449dc..86e5a58 100644 --- a/src/ttf/data/empty.js +++ b/src/ttf/data/empty.js @@ -8,19 +8,19 @@ define( /* eslint-disable */ return { "version": 1, - "numTables": 12, + "numTables": 10, "searchRenge": 128, "entrySelector": 3, "rengeShift": 64, "head": { "version": 1, "fontRevision": 1, - "checkSumAdjustment": 369537602, + "checkSumAdjustment": 0, "magickNumber": 1594834165, "flags": 11, "unitsPerEm": 1024, - "created": "2014-12-06T22:05:19.000Z", - "modified": "2014-12-06T22:20:03.000Z", + "created": 1428940800000, + "modified": 1428940800000, "xMin": 34, "yMin": 0, "xMax": 306, @@ -77,7 +77,14 @@ define( "name": ".notdef" }], "cmap": {}, - "name": {}, + "name": { + "fontFamily": "fonteditor", + "fontSubFamily": "Medium", + "uniqueSubFamily": "FontEditor 1.0 : fonteditor", + "version": "Version 1.0 ; FontEditor (v0.0.1)", + "postScriptName": "fonteditor", + "fullName": "fonteditor" + }, "hhea": { "version": 1, "ascent": 812, @@ -142,8 +149,8 @@ define( "ulUnicodeRange4": 0, "achVendID": "PfEd", "fsSelection": 192, - "usFirstCharIndex": 0, - "usLastCharIndex": 0, + "usFirstCharIndex": 65535, + "usLastCharIndex": -1, "sTypoAscender": 812, "sTypoDescender": -212, "sTypoLineGap": 92, diff --git a/src/ttf/getEmptyttfObject.js b/src/ttf/getEmptyttfObject.js index 386b0ad..380e4b7 100644 --- a/src/ttf/getEmptyttfObject.js +++ b/src/ttf/getEmptyttfObject.js @@ -14,6 +14,7 @@ define( function getEmpty() { var ttf = lang.clone(emptyttf); lang.extend(ttf.name, config.name); + ttf.head.created = Date.now(); return ttf; } diff --git a/src/ttf/table/OS2.js b/src/ttf/table/OS2.js index 1e8032a..bd03ed4 100644 --- a/src/ttf/table/OS2.js +++ b/src/ttf/table/OS2.js @@ -133,7 +133,7 @@ define( // os2 count var xAvgCharWidth = 0; - var usFirstCharIndex = 0xFFFF; + var usFirstCharIndex = 0x10FFFF; var usLastCharIndex = -1; // maxp