ExtractTtc: Ruby gem to extract TTF from TTC
Purpose
The gem lets you extract individual TrueType font files (.ttf
) from a TrueType Collection file (.ttc
).
ExtractTtc
wraps functionality provided by stripttc.c
, originally from the
FontForge project as an FFI extension.
Specifically, stripttc.c
is part of the contribs
directory of FontForge, which
is
assigned
the
BSD 3-Clause license.
Installation
Add this line to your application’s Gemfile
:
gem 'extract_ttc'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install extract_ttc
Usage
ExtractTtc.extract("path/to/ttc/Helvetica.ttc")
Would extract contained TTF files from TTC to a current directory.
Development
We are following Sandi Metz’s Rules for this gem, you can read the description of the rules here. All new code should follow these rules. If you make changes in a pre-existing file that violates these rules you should fix the violations as part of your contribution.
Setup
Clone the repository:
git clone https://github.com/fontist/extract_ttc
Setup your environment:
bin/setup
Run the test suite:
bundle exec rspec
If any changes are made in the C code, then the extension needs to be recompiled:
bundle exec rake recompile
You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
First, thank you for contributing! We love pull requests from everyone. By participating in this project, you hereby grant Ribose Inc. the right to grant or transfer an unlimited number of non exclusive licenses or sub-licenses to third parties, under the copyright covering the contribution to use the contribution by all means.
Here are a few technical guidelines to follow:
-
Open an issue to discuss a new feature.
-
Write tests to support your new feature.
-
Make sure the entire test suite passes locally and on CI.
-
Open a Pull Request.
-
Squash your commits after receiving feedback.
-
Party!
License
This gem is distributed with a BSD 3-Clause license.
stripttc.c
is obtained from:
https://github.com/fontforge/fontforge/blob/master/contrib/fonttools/stripttc.c
The BSD 3-Clause licence for stripttc.c
is provided in ext/stripttc/LICENSE
.
This gem is developed, maintained and funded by Ribose Inc.