From caedd817e1fc5bff96d55934073fe2c895ce0761 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Mon, 9 Nov 2020 19:47:28 +0800 Subject: [PATCH] Update for first release --- LICENSE => LICENSE.adoc | 2 +- README.adoc | 121 ++++++++++++++++++++++++++++++++++++++++ README.md | 96 ------------------------------- ext/stripttc/LICENSE | 31 ++++++++++ ext/stripttc/Makefile | 3 + extract_ttc.gemspec | 4 +- 6 files changed, 158 insertions(+), 99 deletions(-) rename LICENSE => LICENSE.adoc (98%) create mode 100644 README.adoc delete mode 100644 README.md create mode 100644 ext/stripttc/LICENSE diff --git a/LICENSE b/LICENSE.adoc similarity index 98% rename from LICENSE rename to LICENSE.adoc index d0b3ad8..3fec3ee 100644 --- a/LICENSE +++ b/LICENSE.adoc @@ -1,4 +1,4 @@ -BSD 3-Clause License += BSD 3-Clause License Copyright (c) 2020 Ribose Inc. All rights reserved. diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..c8c9e68 --- /dev/null +++ b/README.adoc @@ -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.] diff --git a/README.md b/README.md deleted file mode 100644 index a895693..0000000 --- a/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# ExtractTtc - -The gem lets extract TTC font collection files. - -It wraps stripttc.c from the FontForge project as FFI extension. - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'extract_ttc' -``` - -And then execute: - - $ bundle install - -Or install it yourself as: - - $ gem install extract_ttc - -## Usage - -```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 -[description of the rules here][sandi-metz] 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 - -```sh -git clone https://github.com/fontist/extract_ttc -``` - -Setup your environment - -```sh -bin/setup -``` - -Run the test suite - -```sh -bundle exec rspec -``` - -If any changes are made in the C code, then the extension needs to be recompiled - -```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 [rubygems.org](rubygems). - - -## Contributing - -First, thank you for contributing! We love pull requests from everyone. By -participating in this project, you hereby grant [Ribose Inc.][riboseinc] 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 [issue][issues] 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. [Squash your commits][squash] after receiving feedback. -1. Party! - - -## Credit - -This gem is developed, maintained and funded by [Ribose Inc.][riboseinc] - - -[rubygems]: https://rubygems.org -[riboseinc]: https://www.ribose.com -[issues]: https://github.com/fontist/extract_ttc/issues -[squash]: https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature -[sandi-metz]: http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers diff --git a/ext/stripttc/LICENSE b/ext/stripttc/LICENSE new file mode 100644 index 0000000..17369bd --- /dev/null +++ b/ext/stripttc/LICENSE @@ -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. diff --git a/ext/stripttc/Makefile b/ext/stripttc/Makefile index 83aaeb6..d77ef82 100644 --- a/ext/stripttc/Makefile +++ b/ext/stripttc/Makefile @@ -1,3 +1,6 @@ +# stripttc.c originates from: +# https://github.com/fontforge/fontforge/blob/master/contrib/fonttools/stripttc.c + default: stripttc.so stripttc.so: stripttc.o diff --git a/extract_ttc.gemspec b/extract_ttc.gemspec index c202b24..ca3a223 100644 --- a/extract_ttc.gemspec +++ b/extract_ttc.gemspec @@ -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 = ["operations@ribose.com", "alexey.morozov.is@gmail.com"] + spec.authors = ["Ribose Inc."] + spec.email = ["operations@ribose.com"] spec.summary = "Extract TTC file to TTF files" spec.description = "Extract font collection to separate font files"