-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
158 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
BSD 3-Clause License | ||
= BSD 3-Clause License | ||
|
||
Copyright (c) 2020 Ribose Inc. All rights reserved. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
= 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 | ||
https://github.com/fontforge/fontforge[FontForge project] as an FFI extension. | ||
|
||
Specifically, `stripttc.c` is part of the `contribs` directory of FontForge, which | ||
is | ||
https://github.com/fontforge/fontforge/blob/21ad4a18fb3d4becfe566d8215eba4483b0ddc4b/contrib/CMakeLists.txt#L1[assigned] | ||
the | ||
https://github.com/fontforge/fontforge/blob/21ad4a18fb3d4becfe566d8215eba4483b0ddc4b/LICENSE#L12-L57[BSD 3-Clause license]. | ||
|
||
|
||
== Installation | ||
|
||
Add this line to your application's `Gemfile`: | ||
|
||
[source,ruby] | ||
---- | ||
gem 'extract_ttc' | ||
---- | ||
|
||
And then execute: | ||
|
||
[source,sh] | ||
---- | ||
$ bundle install | ||
---- | ||
|
||
Or install it yourself as: | ||
|
||
[source,sh] | ||
---- | ||
$ gem install extract_ttc | ||
---- | ||
|
||
== Usage | ||
|
||
[source,ruby] | ||
---- | ||
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 | ||
http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[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: | ||
|
||
[source,sh] | ||
---- | ||
git clone https://github.com/fontist/extract_ttc | ||
---- | ||
|
||
Setup your environment: | ||
|
||
[source,sh] | ||
---- | ||
bin/setup | ||
---- | ||
|
||
Run the test suite: | ||
|
||
[source,sh] | ||
---- | ||
bundle exec rspec | ||
---- | ||
|
||
If any changes are made in the C code, then the extension needs to be recompiled: | ||
|
||
[source,sh] | ||
---- | ||
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 https://rubygems.org[rubygems.org]. | ||
|
||
|
||
== Contributing | ||
|
||
First, thank you for contributing! We love pull requests from everyone. By | ||
participating in this project, you hereby grant https://www.ribose.com[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: | ||
|
||
1. Open an https://github.com/fontist/extract_ttc/issues[issue] to discuss a new feature. | ||
1. Write tests to support your new feature. | ||
1. Make sure the entire test suite passes locally and on CI. | ||
1. Open a Pull Request. | ||
1. https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits] | ||
after receiving feedback. | ||
1. 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 https://www.ribose.com/[Ribose Inc.] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
BSD 3-Clause License for stripttc.c | ||
|
||
Copyright (c) George Williams and FontForge authors. All rights reserved. | ||
https://github.com/fontforge/fontforge/blob/master/AUTHORS | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
The name of the author may not be used to endorse or promote | ||
products derived from this software without specific prior written | ||
permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS | ||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ require_relative "lib/extract_ttc/version" | |
Gem::Specification.new do |spec| | ||
spec.name = "extract_ttc" | ||
spec.version = ExtractTtc::VERSION | ||
spec.authors = ["Ribose Inc.", "Alexey Morozov"] | ||
spec.email = ["[email protected]", "[email protected]"] | ||
spec.authors = ["Ribose Inc."] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "Extract TTC file to TTF files" | ||
spec.description = "Extract font collection to separate font files" | ||
|