{"id":19474620,"url":"https://github.com/tomasc/dragonfly_fonts","last_synced_at":"2026-06-07T21:31:51.322Z","repository":{"id":24060351,"uuid":"27446397","full_name":"tomasc/dragonfly_fonts","owner":"tomasc","description":"Wraps common font-related tasks into Dragonfly analysers and processors.","archived":false,"fork":false,"pushed_at":"2018-09-19T08:21:09.000Z","size":6895,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-29T14:42:00.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomasc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-02T18:16:13.000Z","updated_at":"2018-09-19T08:07:32.000Z","dependencies_parsed_at":"2022-08-24T01:31:01.250Z","dependency_job_id":null,"html_url":"https://github.com/tomasc/dragonfly_fonts","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_fonts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_fonts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_fonts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fdragonfly_fonts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasc","download_url":"https://codeload.github.com/tomasc/dragonfly_fonts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240697826,"owners_count":19843277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:25:52.754Z","updated_at":"2026-06-07T21:31:51.272Z","avatar_url":"https://github.com/tomasc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dragonfly Fonts\n\n[![Circle CI](https://circleci.com/gh/tomasc/dragonfly_fonts.svg?style=svg\u0026circle-token=3b836116bd1aaa6b76103b45ab0caef112b3df94)](https://circleci.com/gh/tomasc/dragonfly_fonts) [![Gem Version](https://badge.fury.io/rb/dragonfly_fonts.svg)](http://badge.fury.io/rb/dragonfly_fonts) [![Coverage Status](https://img.shields.io/coveralls/tomasc/dragonfly_fonts.svg)](https://coveralls.io/r/tomasc/dragonfly_fonts)\n\nWraps common font-related tasks into [Dragonfly](http://markevans.github.io/dragonfly) analysers and processors.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'dragonfly_fonts'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install dragonfly_fonts\n\n## Dependencies\n\n### FontForge\n\nYou will need [FontForge](http://fontforge.github.io) with Python extensions installed.\n\nUsing [Homebrew](http://brew.sh):\n\n    $ brew install fontforge --enable-pyextension\n\nUsing debian/ubuntu packages:\n\n    $ sudo apt-get install fontforge python-fontforge\n\n### fonttools\n\nSee [fonttools](https://github.com/behdad/fonttools)\n\n### ots-sanitize\n\nSee [ots-sanitize](https://github.com/khaledhosny/ots)\n\n### ttf2eot\n\nSee [ttf2eot](http://code.google.com/p/ttf2eot).\n\n### ttfautohint\n\nSee [ttfautohint](http://www.freetype.org/ttfautohint/doc/ttfautohint.html).\n\n### woff2\n\nSee [woff2](https://github.com/google/woff2).\n\n## Usage\n\nAdd the `:fonts` plugin to your Dragonfly config block:\n\n```ruby\nDragonfly.app.configure do\n  plugin :fonts\nend\n```\n\n## Supported Formats\n\nList of supported formats is available as:\n\n```ruby\nDragonflyFonts::SUPPORTED_FORMATS # =\u003e [\"bdf\", \"dfont\", \"bin\", …]\nDragonflyFonts::SUPPORTED_OUTPUT_FORMATS # =\u003e [\"eot\", \"ttf\", …]\n```\n\n## Analysers\n\n### Bbox\n\nReturns `Struct.new(\"Bbox\", :glyph, :min_x, :min_y, :max_x, :max_y, :width, :height)` representing the glyph's bounding box.\n\n```ruby\nDragonflyFonts::Analysers::Bbox.new.call(font, glyph)\n```\n\n### Font Info\n\nReturns information about the font as a Hash with the following keys: `:ascent`, `:cap_height`, `:comment`, `:copyright`, `:default_base_filename`, `:descent`, `:descriptor`, `:designer`, `:designer_url`, `:em`, `:embedding_restrictions`, `:encoding`, `:familyname`, `:fontlog`, `:fontname`, `:fullname`, `:license`, `:license_url`, `:path`, `:sfnt_revision`, `:trademark`, `:upos`, `:uwidth`, `:vendor_url`, `:version`, `:weight`, `:woff_metadata`, `:woff_revision`, `:x_height`.\n\n```ruby\nfont.font_info\n```\n\n### Glyphs\n\nReturns `Array` of all glyphs contained in the font, each glyph represented by a Hash with the following keys: `:glyphclass`, `:glyphname`, `:encoding`, `:script`, `:width`, `:unicode`.\n\n```ruby\nfont.glyphs\n```\n\n### GSUB Tables\n\nReturns `Array` of gsub tables in the font.\n\n```ruby\nfont.gsub_tables\n```\n\n### OTS Sanitize\n\nDisplays output of the `ots-sanitize` command.\n\n```ruby\nfont.ots_sanitize\n\n```\n\n## Processors\n\n### Correct Metrics\n\nNormalizes ascent and descent values.\n\n```ruby\nfont.correct_metrics\n```\n\n### Encode\n\nAllows for conversion to EOT, OTF, SVG, TTF, WOFF, WOFF2, TTX.\n\n```ruby\nfont.encode(:woff)\n```\n\n* OTF, SVG, TTF, WOFF conversion is handled by `FontForge`.\n* EOT conversion is handled by `ttf2eot`. The input font needs to be in TTF format. Due to bug in IE, font FullName MUST begin with FamilyName. For example, if FamilyName is fontello, then FullName should be fontello regular and so on. In this condition is not satisfyed, then font will not be shown in IE.\n* WOFF2 conversion is handled by `woff2`.\n* TTX conversion is handled by `ttx` (fonttools).\n\n### Extract Glyph\n\nExtracts specified glyph in SVG format.\n\n```ruby\nfont.extract_glyph('A')\n```\n\n### Fix DFLT table\n\nFix for DFLT tables causing issues in Firefox 44.\n\n```ruby\nfont.fix_dflt_table\n```\n\n### Normalize Names\n\nFix for rejected EOT's in IE8.\n\n```ruby\nfont.normalize_names\n```\n\n### OTS\n\nSanitize OTF/TTF \u0026 WOFF/2 font files.\n\n```ruby\nfont.ots_sanitize!\n```\n\n### Set Dimensions\n\nAdjust ascent \u0026 descent by an increment of.\n\n```ruby\nfont.set_dimensions(ascent: 10, descent: -10)\n```\n\n### Set TTF Names\n\nAllows to set the following TTF properties: `:compatible_full`, `:copyright`, `:description`, `:designer`, `:designer_url`, `:fontname`, `:fullname`, `:license`, `:license_url`, `:manufacturer`, `:postscript_cid`, `:postscript_name`, `:preferred_family`, `:preferred_subfamily`, `:sample_text`, `:trademark`, `:uid`, `:vendor_url`, `:version`, `:weight`. See [docs at Adobe](http://partners.adobe.com/public/developer/opentype/index_name.html#enc4) for more details.\n\n```ruby\nttf_names = { designer: 'John Doe' }\nfont.set_ttf_names(ttf_names)\n```\n\n### Set Underline\n\nAllows to set underline properties: position and width.\n\n```ruby\nfont.set_underline({ upos: 1, uwidth: 1 })\n```\n\n### Set Width\n\nSets width of each character. The relative parameter can have the following values:\n\n* when 0 the vertical width will be set exactly to `width` value\n* when 1 then the vertical width will be incremented by `width` value\n* when 2 then the vertical width will be scaled by `width` value/100.0.\n\n```ruby\nfont.set_width(width, relative=1)\n```\n\n### Set WOFF Metadata\n\nConverts font to WOFF and sets license-related values of embedded XML metadata. The rest of the metadata is automatically inferred from font properties (see `#set_ttf_names`).\n\n```ruby\nfont.set_woff_metadata(uniqueid, licensee_name)\n```\n\n### TTF autohint\n\nGenerates FreeType auto hints. See [ttfautohint](http://www.freetype.org/ttfautohint/doc/ttfautohint.html).\n\n```ruby\nfont.ttf_autohint\n```\n\n### Web Friendly\n\nMake web friendly.\n\n```ruby\nfont.web_friendly\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/tomasc/dragonfly_fonts/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fdragonfly_fonts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasc%2Fdragonfly_fonts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fdragonfly_fonts/lists"}