这是 FontForge 的 Ruby 版 SDK。
- 可以用于解析字体文件,得到 font_name, family_name 等
- 可以转换字体格式(如 .ttf, .otf, .woff, .svg 等)
$ gem install font-converter
In Rails, add it to your Gemfile:
gem 'font-converter'
then run $ bundle install
首先你的机器上需要安装好 fontforge
brew install fontforge
FontForge.parse('/my_path/test.woff') # => { font_name: 'xxx', full_name: 'xxx', family_name: 'xxx' }
# FontForge.convert(path, new_path)
FontForge.convert('/my_path/test.ttf', '/my_path/test.woff') # convert .ttf format to .woff
- Fork it (https://github.com/renny-ren/font-converter)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request