Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json 的main写错、lib/Font.js 报错 #1

Closed
aui opened this issue Aug 16, 2014 · 8 comments
Closed

package.json 的main写错、lib/Font.js 报错 #1

aui opened this issue Aug 16, 2014 · 8 comments

Comments

@aui
Copy link

aui commented Aug 16, 2014

  • package.json 的main写错,应该是"main": "./src/index.js"
  • lib/Font.js 99行 报错:Cannot read property 'glyphIndexArray' of undefined
    结论:库无法使用
@qdsang
Copy link
Owner

qdsang commented Aug 16, 2014

@aui 抱歉, 弄了个残疾上去
1.已经修复
2.残疾

@aui
Copy link
Author

aui commented Aug 16, 2014

方正兰亭超细黑简体

我也在做字体自动化压缩的工具,完善后将开源,到时候可以一起交流。

@qdsang
Copy link
Owner

qdsang commented Aug 17, 2014

https://github.com/qdsang/fonts-streamline
先前弄了个只支持svg格式字体的优化

@aui
Copy link
Author

aui commented Aug 18, 2014

修改 lib/Font.js 98 行后可以支持中文字体

    this.cmap.cmaps.forEach(function (item, index) {
        item.glyphIndexArray.forEach(function (glyphIndex, code) {
            glyphIndex = index + glyphIndex;
            var glyph = self.glyf.glyphs[glyphIndex];

            var char = toChar(code);

            if (!!glyphIndex && !!glyph && char) {
                glyphs.push({
                    unicode: char,
                    boundingBox: glyph.boundingBox,
                    path: glyph.toSVGPath()
                });
            }
        });
    });

但是,仍然有另外一个问题没有解决:

如果字体是被精简后的版本(缺乏字符),工具无法转换

@qdsang
Copy link
Owner

qdsang commented Aug 18, 2014

我也是这么尝试了下,发现生成后的字体库存在重复的,并且unicode部分错误。

题外话: 米厂也再在大量使用方正兰亭超细,不知道是巧还是大势

aui pushed a commit to aui/ttf2svg that referenced this issue Aug 18, 2014
@aui aui mentioned this issue Aug 18, 2014
@aui
Copy link
Author

aui commented Aug 18, 2014

如果字体是被精简后的版本(缺乏字符),工具无法转换
--- 已经帮修复

@aui
Copy link
Author

aui commented Aug 19, 2014

lib/Font.js 的 42 行getMeta方法错误,没有获取到预期返回结果,导致输出的 svg 文件缺失idfont-family字段。

@qdsang
Copy link
Owner

qdsang commented Aug 19, 2014

font-family 取值有些问题
image

使用fontforge 生成的svg字体只有2.9M
使用ttf2svg 生成4.4M, 感觉像是某个区块重复了

family取值的修改已经提交了

@qdsang qdsang closed this as completed Jan 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants