No commit activity in last 3 years
No release in over 3 years
Harfbuzz renderer wrapped by Dragonfly processors.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Dragonfly Harfbuzz

Build Status Gem Version Coverage Status

Harfbuzz renderer wrapped by Dragonfly processors.

Installation

Add this line to your application's Gemfile:

gem 'dragonfly_harfbuzz'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dragonfly_harfbuzz

You will also need Harfbuzz installed.

Using Homebrew:

$ brew install --with-cairo harfbuzz

Or build from source. See Harfbuzz website for instructions.

Usage

Add the :harfbuzz plugin to your Dragonfly config block:

Dragonfly.app.configure do
  plugin :harfbuzz
  # ...
end

Then use as:

font.hb_view('my text', :svg, { font_size: 36 })

See tests and hb-view --help-all for more details on options.

Supported Formats

List of supported formats is available as:

DragonflyHarfbuzz::SUPPORTED_FORMATS # => ["otf"]
DragonflyHarfbuzz::SUPPORTED_OUTPUT_FORMATS # => ["ansi", "png", "svg", "pdf", "ps", "eps"]

Options

Additionally (for <svg> only) you can pass the following options: translate: Hash[x: 0, y: 0], markup_svg: Boolean, split_paths: Boolean and flatten_svg: Boolean.

translate translates glyph positions by specified x and/or y offset.

markup_svg returns an <svg> that is organized into word and characters and marked up with additional data attributes.

flatten_svg uses the result of markup_svg and further cleans up the <svg>, replacing the <symbol>, <use> elements with nested <svg>s. This is handy if you want to do some more precise animation/manipulation of the resulting <svg>.

split_paths is a feature of the markup_svg and controls whether the paths of each character are split up into smaller components.

Contributing

  1. Fork it ( https://github.com/tomasc/dragonfly_harfbuzz/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request