Coder Social home page Coder Social logo

fontcustom's Introduction

Gem Version Build Status Code Quality Bountysource

Font Custom

Icon fonts from the command line.

Generate cross-browser icon fonts and supporting files (@font-face CSS, etc.) from a collection of SVGs (example).

Changelog
Bugs/Support
Contribute!

Installation

Requires Ruby 1.9.3+, WOFF2, FontForge with Python scripting.

# On Mac
brew tap bramstein/webfonttools
brew update
brew install woff2

brew install fontforge --with-python
brew install eot-utils
gem install fontcustom

# On Linux
sudo apt-get install zlib1g-dev fontforge
git clone https://github.com/bramstein/sfnt2woff-zopfli.git sfnt2woff-zopfli && cd sfnt2woff-zopfli && make && mv sfnt2woff-zopfli /usr/local/bin/sfnt2woff
git clone --recursive https://github.com/google/woff2.git && cd woff2 && make clean all && sudo mv woff2_compress /usr/local/bin/ && sudo mv woff2_decompress /usr/local/bin/
gem install fontcustom

####Note for windows:

  1. Install fontforge: http://fontforge.github.io/en-US/downloads/windows/
  • Install to a path without spaces, eg c:\FontForgeBuilds
  • At the end of the installer check the 'run fontforge' box. It finishes some set up.
  1. Add the installation path to your System PATH variable (c:\FontForgeBuilds\bin)
  2. Open up a new command prompt and test it. fontforge -help
  3. gem install fontcustom

Quick Start

fontcustom compile my/vectors  # Compiles icons into `fontcustom/`
fontcustom watch my/vectors    # Compiles when vectors are changed/added/removed
fontcustom compile             # Uses options from `./fontcustom.yml` or `config/fontcustom.yml`
fontcustom config              # Generate a blank a config file
fontcustom help                # See all options

Configuration

To manage settings between compiles, run fontcustom config to generate a config file. Inside, you'll find a list of all possible options. Each option is also available as a dash-case command line flag (e.g. --css-selector) that overrides the config file.

SVG Guidelines

  • All colors will be rendered identically. Watch out for white fills!
  • Use only solid colors. SVGs with transparency will be skipped.
  • For greater precision in curved icons, use fills instead strokes and try these solutions.
  • Activating autowidth trims horizontal white space from each glyph. This can be much easier than centering dozens of SVGs by hand.

Advanced

For use with Compass and/or Rails

Set templates to include scss-rails to generate a SCSS partial with the compatible font-url() helper. You'll most likely also need to set preprocessor_path as the relative path from your compiled CSS to your output directory.

Example Use in Rails

Add gem 'fontcustom' to your gem file.

bundle

Create a fontcustom.yml file with something like this:

# config/fontcustom.yml

font_name: icons
css_selector: .icon-{{glyph}}
preprocessor_path: ""
autowidth: false
no_hash: true
force: false
debug: false
quiet: false

input:
  vectors: app/assets/icons

output:
  fonts: app/assets/fonts
  css: app/assets/stylesheets

templates:
 - scss

This tells the gem to take the vectors from app/assets/icons and create fonts and stylesheets for them.

Create a file in lib/tasks called icons.rake :

namespace :icons do
  task :compile do
    puts "Compiling icons..."
    puts %x(fontcustom compile)
  end
end

Load up the icons directory and test it out.

Run this command with

rake icons:compile

This should run the installed and configured gem to create your icons:

Compiling icons...
      create  .fontcustom-manifest.json
      create  app/assets/fonts
      create  app/assets/fonts/icons.ttf
              app/assets/fonts/icons.svg
              app/assets/fonts/icons.woff
              app/assets/fonts/icons.eot
      create  app/assets/stylesheets/_icons.scss

Access these new icons by creating a tag with the class icon-{{glyph}} where the {{glyph}} is the name of the svg you put in the icon folder. For example, if you added a file called 'cars54' icon would look something like this:

<i class="icon-cars54"</i>

Now the font is adjustable to css 'font-size' and 'color'.

Save CSS and fonts to different locations

You can save generated fonts, CSS, and other files to different locations by using fontcustom.yml. Font Custom can also read input vectors and templates from different places.

Just edit the input and output YAML hashes and their corresponding keys.

Tweak font settings

By default, Font Custom assumes a square viewBox, 512 by 512, and 16 pica points. Change font_design_size, font_em, font_ascent, font_descent, and autowidth to suit your own needs.

Generate LESS, Stylus, and other text files

Custom templates give you the flexibility to generate just about anything you want with Font Custom's output data.

Any non-SVG file in your input directory (or input:templates directory if you set it in fontcustom.yml) will be available as a custom template to copy into the output directory after compilation. You just need to specify the file name under the templates hash.

Any embedded ruby in the templates will be processed, along with the following helpers:

  • font_name
  • font_face: FontSpring's Bulletproof @Font-Face Syntax
  • glyph_selectors: comma-separated list of all icon CSS selectors
  • glyphs: all selectors and their codepoint assignments (.icon-example:before { content: "\f103"; })
  • @options: a hash of options used during compilation
  • @manifest: a hash of options, generated file paths, code points, and just about everything else Font Custom knows.
  • @font_path: the path from CSS to font files (without an extension)
  • @font_path_alt: if preprocessor_path was set, this is the modified path
  • pseudo_element: if css3 was set to true, then it will print ::before. Otherwise the PseudoElement will be :before

font_face accepts a hash that modifies the CSS url() function and the path of the font files (font_face(url: "font-url", path: @font_path_alt)).


Licenses

Brought to you by @endtwist and @kaizau

fontcustom's People

Contributors

asianchris avatar bodaniel avatar bountysource-support avatar chrishamant avatar dagjomar avatar davewasmer avatar endtwist avatar foca avatar francispotter avatar guille-moe avatar jakeberesford avatar jasontbradshaw avatar jdell64 avatar jvatic avatar kaizau avatar krisselden avatar lukemelia avatar mcguffin avatar mhodgson avatar nebulon42 avatar phallstrom avatar pilif avatar roeln avatar sam-livefront avatar stretchkennedy avatar thefrontender avatar timmoore avatar trevorsayre avatar twalpole avatar unity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fontcustom's Issues

error when trying to compile entypo font

hey i get this error when trying to compile the entypo svgs

command: fontcustom compile final-svg

create fontcustom
/var/lib/gems/1.9.1/gems/json-1.7.5/lib/json/common.rb:155:in parse': 757: unexpected token at 'OSError: [Errno 8] Fehler im Format der Programmdatei' (JSON::ParserError) from /var/lib/gems/1.9.1/gems/json-1.7.5/lib/json/common.rb:155:inparse'
from /var/lib/gems/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in generate' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:inrun'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in invoke_task' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:inblock in invoke_all'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in each' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:inmap'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in invoke_all' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:indispatch'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in start' from /var/lib/gems/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:incompile'
from /var/lib/gems/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in compile' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:inrun'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in invoke_task' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:indispatch'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in start' from /var/lib/gems/1.9.1/gems/fontcustom-0.0.2/bin/fontcustom:5:in<top (required)>'
from /usr/local/bin/fontcustom:23:in load' from /usr/local/bin/fontcustom:23:in

'

"Fehler im Format der Programmdatei" means something like error in the format of the programfile ;)

grid in compiled font

Hey, after compiling some svg I received all icons with an grid in the background in the *.ttf file.
Any idea what causes this?

how to produce a svg that's actually working

Hey there,

I gave Font Custom a try with an icon I created with Adobe Illustrator but the result was disappointing: My star with a solid black background was converted into a rectangle with a black border.
I saved the file as svg with the default settings.

To find out if this is a general problem I took two svg files I didn't create:
This works: http://upload.wikimedia.org/wikipedia/commons/7/78/Biokit.svg but the icon is very small.
This doesn't work: http://upload.wikimedia.org/wikipedia/commons/e/eb/Angband.svg โ€“ something that looks like the top of the head is on the far right of the icon, next to it there is just a black bar.

Screenshot: http://oi46.tinypic.com/24zjhcg.jpg

Maybe someone else can try out those two files or even better, give me directions on how to convert/save my icons so that I can use them with Font Custom?

Thanks,
Dominik

Separation of concerns for further extensibility

Hey guys! First off, great work on this project.

This issue is focused on architecture and to start an open forum on said architecture.

My primary concern is that fontcustom is doing too many things without room for customization. It goes from folder to folder of SVGs to CSS in one fell swoop.

This does not allow for a very open experience. I would like to see something like a set of a few modules:

  • A function that takes in an array of paths (svgPaths), the names of a font makers (e.g. ttf, woff), and any other relevant options
    • This returns a binary string of each font AND a JSON representation of file name -> unicode value of HTML entity
  • A function that takes JSON (the same file name one), the name of a converter (e.g. SASS, CSS-Bootstrap), and any other relevant options
    • This returns the template representation of the JSON (e.g. CSS, SASS, SCSS)
    • Here we can make it 10x developer friendly by allowing for converters to be raw functions. As a result, they can use any templating engine they want (or output raw strings)
  • A CLI function that combines the two modules above together

The reason for the separations above are for a few reasons:

  • Granularity/single purposeness to test against
  • Reuse of smaller parts amongst developers
  • Smaller parts to extend and pull request on

Lastly, if you are confused and wondering who is this guy. It's because I have written something similar (grunt-spritesmith / spritesmith) which is split up into 5 modules and are much easier to maintain than 1 monolith.

756: unexpected token at 'sh: fontforge: command not found' (JSON::ParserError)

I've just installed home brew, followed your installation instructions on the website and added some .svg files to the folder. When I run the watch command I see the fontcustom folder get created but nothing gets generated inside. I then tried the compile command and get this output. Any idea what's wrong?

/Library/Ruby/Gems/1.8/gems/json-1.6.5/lib/json/common.rb:148:in `parse': 756: unexpected token at 'sh: fontforge: command not found' (JSON::ParserError)
from /Library/Ruby/Gems/1.8/gems/json-1.6.5/lib/json/common.rb:148:in `parse'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in `generate'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `send'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/shell.rb:14:in `map'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/core_ext/ordered_hash.rb:75:in `each'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:in `compile'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in `compile'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `send'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/bin/fontcustom:5
from /usr/bin/fontcustom:19:in `load'
from /usr/bin/fontcustom:19

Can't get it to work

I'm on OSX (Mountain Lion).
Whenever I try to compile a folder I get the following errors in the terminal:

MacbookPro% fontcustom compile /Users/stookstudio/Desktop/Eps
sh: line 1: 63683 Abort trap: 6 fontforge -script /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/fontcustom-0.0.2/lib/fontcustom/scripts/generate.py /Users/stookstudio/Desktop/Eps /Users/stookstudio/Desktop/fontcustom /dev/null 2>&1
/Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/lib/json/common.rb:155:in parse': 757: unexpected token at '*** set a breakpoint in malloc_error_break to debug' (JSON::ParserError) from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/lib/json/common.rb:155:inparse'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in generate' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/task.rb:27:inrun'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:120:in invoke_task' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:126:inblock in invoke_all'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:126:in each' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:126:inmap'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:126:in invoke_all' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/group.rb:238:indispatch'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/base.rb:425:in start' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:incompile'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in compile' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/task.rb:27:inrun'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/invocation.rb:120:in invoke_task' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor.rb:275:indispatch'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.16.0/lib/thor/base.rb:425:in start' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/gems/fontcustom-0.0.2/bin/fontcustom:5:in<top (required)>'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/bin/fontcustom:19:in load' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/bin/fontcustom:19:in

'
from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in eval' from /Users/stookstudio/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in'

Any idea what's causing this?

Add development documentation

When trying to run the test suite using bundle exec rake or bundle exec rake test or bundle exec rake spec, I see no output. What command should I be using to run the tests?

fontcustom master* $ bundle exec rake
/Users/zeke/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -I"lib:lib/fontcustom:spec:spec/fixtures" -I"/Users/zeke/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib" "/Users/zeke/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/rake_test_loader.rb" "spec/fontcustom/fontcustom_spec.rb" "spec/fontcustom/generator_spec.rb" 

fontcustom master* $ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

This kind of information should probably go in CONTRIBUTING.MD, per Github's new contributing guidelines.

Ability to output .scss file

Possibly add a flag (like -scss) to outout a .scss file instead of .css file. That way it can be compiled with your other sass/compass files into one css file.

Sprockets integration breaks because of digest

It's not possible to use fontcustom-generated font files and css with Sprockets for now.

The digest in the filename prevents sprockets from serving the file (didn't look into the specific reason)

A simple (and manual) fix is to remove the digest from the file names and mirror that in the CSS
Then Sprockets is able to serve the files.

A command line toggle to enable/disable fingerprinting would solve this quickly while waiting for a full sprockets integration.

Included versions of sfntwoff and ttf2eot don't work in Ubuntu 11.10

sfntwoff throws an OSError [Errno 8]

ttf2eot generates an empty file

I had to manually install both utilities from source :

and then edit generate.py to remove scriptPath from calls :

call(['sfnt2woff', fontfile + '.ttf'])
call('ttf2eot ' + fontfile + '.ttf > ' + fontfile + '.eot', shell=True)

I'm not sure what ttfautohint does, I did not check wether it works or not

CentOS Compatibility?

Tried installing on my 5.8 box -- complete and utter failure. All kinda of software is simply not up to the standards this using.

Installed a fresh VM on 6.3 -- process went almost better until I hit:

# fontcustom compile ./svgs/
      remove  fontcustom/fontcustom.css
Copyright (c) 2000-2009 by George Williams.
 Executable based on sources from 22:35 GMT 22-Jun-2009.
 Library based on sources from 22:35 GMT 22-Jun-2009.
Traceback (most recent call last):
  File "/usr/lib64/ruby/gems/1.8/gems/fontcustom-0.1.1/lib/fontcustom/scripts/generate.py", line 5, in <module>
    import argparse
ImportError: No module named argparse
      create  ./fontcustom/fontcustom.woff
      create  ./fontcustom/fontcustom.ttf
      create  ./fontcustom/fontcustom.eot
      create  ./fontcustom/fontcustom.svg
      create  fontcustom/fontcustom.css

CentOS 6.3 has python 2.6 -- and argparse is apparently a 2.7 module. Joy.

Tried to then compile fontforge using headers/libraries from a custom installed 2.7 python. That's got it's own failures.

Outside of OSX -- is there a recommended linux to install this tool on? Because, quite honestly, it's been pretty bad up to this point. (Not blaming the tool author, just a statement of fact in a world of complex dependancies.)

mkeot output file not loading in IE8

I'm having trouble getting the eot file to load properly in IE8.

I've tracked the problem down to mkeot. It seems that the output of mkeot is somehow incorrect. I've been able to get the fonts to work in IE8 by using ttf2eot instead.

mkeot custom-font.ttf > custom-font.eot
ttf2eot custom-font.ttf > custom-font.eot

I'm able to reproduce by simply re-running the commands back and forth using the same source ttf file. mkeot creates an eot file that doesn't work; ttf2eot creates an eot file that does work.

I've also included the eotinfo output below from both files. There are some differences, but I can't gauge the significance of any particular difference.

Any tips or suggestions would be helpful.

------ eotinfo output for mkeot file --------
EOTSize: 2662
FontDataSize: 2452
Version: 0x00020002
Flags: not-subsetted not-compressed no-EUDC no-xor
PANOSE: 2 0 6 3 0 0 0 0 0 0
Charset: 0
Italic: no
Weight: 500
fsType: installable
UnicodeRange: private-use-0
CodePageRange: to do...
CheckSumAdjustment: 2115730020
FamilyName: custom-icons
StyleName: icons
VersionName: Version 001.000
FullName: custom-icons
RootString:

------ eotinfo output for ttf2eot file --------
EOTSize: 5186
FontDataSize: 4996
Version: 0x00020001
Flags: subsetted not-compressed no-EUDC no-xor
PANOSE: 2 0 6 3 0 0 0 0 0 0
Charset: 1
Italic: no
Weight: 500
fsType: installable
UnicodeRange: private-use-0
CodePageRange: to do...
CheckSumAdjustment: 18446744073185561037
FamilyName: custom-icons
StyleName: icons
VersionName: Version 001.000
FullName: custom-icons
RootString:

Question: Source optimisation before compiling

After many doubts and tries, I've seen that optimising svg source is a bad and a good thing.

  • It's a good thing because the final font will have less weight
  • It's a bad thing because when you optimise too much your source file, the font will need css properties like font-size: 60px to be well rendered.

So I'd like to know what properties / tags are really needed there: https://gist.github.com/ec1ffa4adada7492a5de The bad one will need font-size: 60px and the good one will need font-size: 22px to be exactly the same final size.

Thanks!

compile issue.

Hi,

I'm using Ubuntu 12.10 with ruby 1.9.1. Compiling .eps format.

I get the error:
7f0d4cdbd000-7f0d4cdcd000 rw-p 00000000 00:00 0 /var/lib/gems/1.9.1/gems/fontcustom-0.1.0/lib/fontcustom/generator.rb:72:in show_paths': undefined methodchomp' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in run' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:ininvoke_task'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in block in invoke_all' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:ineach'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in map' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:ininvoke_all'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:in dispatch' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:instart'
from /var/lib/gems/1.9.1/gems/fontcustom-0.1.0/lib/fontcustom.rb:9:in compile' from /var/lib/gems/1.9.1/gems/fontcustom-0.1.0/lib/fontcustom/cli.rb:15:incompile'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in run' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:ininvoke_task'
from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in dispatch' from /var/lib/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:instart'
from /var/lib/gems/1.9.1/gems/fontcustom-0.1.0/bin/fontcustom:5:in <top (required)>' from /usr/local/bin/fontcustom:23:inload'
from /usr/local/bin/fontcustom:23:in `

'

Any idea what the problem could be? I have searched the internet for a solution but couldn't find anything.

Thanks for your help.

Feature request: hinting for specific sizes

Hello, first of all: very nice work! Will definitely be using fontcustom, though I did already get Glyphs Mini.

And as you may have guessed from the title of this issue, a possibility to hint for specific sizes would be a very powerful feature. I imagine that would make fontcustom the only tool out there to achieve it, if we don't count expensive (and hard to use?) professional font editors such as fontlab.

So, for the majority of web designers / developers out there, the possibility to provide size specific artwork for the glyphs would make fontcustom a must-have, if it isn't already.

This was also requested on the HN thread yesterday: http://news.ycombinator.com/item?id=4832906

Unclear how to un-watch

A directory is watched but it's unclear how it's being watched or how I cancel the "watching". There is no mention in the documentation nor in fontcustom --help.

No compile

Having trouble compiling on OS X Lion (Ruby 1.8.7) using .svg as source files.

When I run fontcustom compile icon-font/svg I get the following output:

create  icon-font/fontcustom
/Library/Ruby/Gems/1.8/gems/json-1.7.1/lib/json/common.rb:149:in `parse': 757: unexpected token at 'sh: fontforge: command not found' (JSON::ParserError)
    from /Library/Ruby/Gems/1.8/gems/json-1.7.1/lib/json/common.rb:149:in `parse'
    from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in `generate'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/shell.rb:14:in `map'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/core_ext/ordered_hash.rb:75:in `each'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:in `compile'
    from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in `compile'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/bin/fontcustom:5
    from /usr/bin/fontcustom:19:in `load'
    from /usr/bin/fontcustom:19

and an empty "fontcustom" dir.

Abort Trap and chomp errors on OS X 10.8.2

I have followed the directions on the main page and looked through all current and past issues without any luck. Here is the output I get:

sh: line 1: 52024 Abort trap: 6           fontforge -script /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/fontcustom-0.1.2/lib/fontcustom/scripts/generate.py /Users/ecurtis/Dropbox/htdocs/tenfourV3/svg/ /Users/ecurtis/Dropbox/htdocs/tenfourV3/fontcustom > /dev/null 2>&1
/Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/fontcustom-0.1.2/lib/fontcustom/generator.rb:72:in `show_paths': undefined method `chomp' for nil:NilClass (NoMethodError)
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/fontcustom-0.1.2/lib/fontcustom.rb:9:in `compile'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/fontcustom-0.1.2/lib/fontcustom/cli.rb:15:in `compile'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/gems/fontcustom-0.1.2/bin/fontcustom:5:in `<top (required)>'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/bin/fontcustom:19:in `load'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/bin/fontcustom:19:in `<main>'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/ecurtis/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'

ie7 support

Would be nice to be able to opt for non PUA, so we could use with straight letter replacement for oldie.

More granular configuration of generate.py

Specifying custom ascent/descent, code points, optional optimizations, etc.

Perhaps generate.py can read directly from JSON config in .fontcustom-data, saving us the trouble of passing everything to the script?

Feature request: custom UPM size and descender amount via the CLI

I design my fonts on a 512x512 canvas with a 16x16 grid so they can be super sharp at a font-size of 16px. Currently I'm using the IcoMoon app to convert my SVGs to a font.

The IcoMoon app allows you to set the height, which defaults to 512, (I believe his height is equivalent to UPM size for TT fonts) as well as the baseline, which for me I like -192.

It would be great if I could set these properties via the CLI. I ran the generate script on my SVGs and they're significantly more blurry than they are with IcoMoon.

I also opened up the generated SVG file and it completely changed the values I'd originally set. I make all SVGs by hand, so I knew what the initial values were supposed to be. It would be great if fontcustom could be configured to not scale my glyphs.

Thanks for your consideration! This gem looks awesome so far, and I can't wait to be able to use it in my build process.

Unable to convert on gem install

Ran

brew install fontforge
gem install fontcustom

And got this:

Successfully installed fontcustom-0.0.2
1 gem installed
Installing ri documentation for fontcustom-0.0.2...
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/sfnt2woff, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/ttf2eot, skipping
unable to convert "\xCE" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/ttfautohint, skipping
Building YARD (yri) index for fontcustom-0.0.2...
Installing RDoc documentation for fontcustom-0.0.2...
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/sfnt2woff, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/ttf2eot, skipping
unable to convert "\xCE" from ASCII-8BIT to UTF-8 for lib/fontcustom/scripts/ttfautohint, skipping

Any thoughts?

Ruby API vs Thor CLI

Any chance the Thor generator could be refactored into a pure Ruby API (that would then be called by the watcher)?

I'd like to use this in Middleman, but we've already got our own watcher and really only need an API like:

FontCustom.generate("path/to/folder", :output => "some_other_folder", :format => :scss)

parse': 757: unexpected token at 'ImportError: No module named argparse'

I can't get fontcustom to work (Mac OS, ruby version 1.8.7, gems 1.8.) The error (and trace) are:

/opt/local/lib/ruby/gems/1.8/gems/json-1.7.5/lib/json/common.rb:157:in parse': 757: unexpected token at 'ImportError: No module named argparse' (JSON::ParserError) from /opt/local/lib/ruby/gems/1.8/gems/json-1.7.5/lib/json/common.rb:157:inparse'
from /opt/local/lib/ruby/gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in generate' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:29:insend'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:29:in run' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:123:ininvoke_task'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:129:in invoke_all' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/shell.rb:14:inmap'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/core_ext/ordered_hash.rb:75:in each' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:129:inmap'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:129:in invoke_all' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/group.rb:238:indispatch'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:427:in start' from /opt/local/lib/ruby/gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:incompile'
from /opt/local/lib/ruby/gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:10:in compile' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:29:insend'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:29:in run' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:123:ininvoke_task'
from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor.rb:277:in dispatch' from /opt/local/lib/ruby/gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:427:instart'
from /opt/local/lib/ruby/gems/1.8/gems/fontcustom-0.0.2/bin/fontcustom:5
from /opt/local/bin/fontcustom:19:in `load'
from /opt/local/bin/fontcustom:19

I have spread a few puts along the error trace to look in a little more detail, getting:

fontcustom compile svg
Output starting thor
compile
svg
Invoking with args
svg
Arguments in invocation
svg
Arguments in task
svg
Arguments in Fontcustom/cli
svg
Output starting thor
compile
svg
Arguments in invocation

Arguments in task

Arguments in invocation

Arguments in task

Arguments in invocation

Arguments in task

Arguments in invocation

Arguments in task

In common.rb:parse
ImportError: No module named argparse

I can't figure what's the problem, but looks like somehow thor, task and the others get all arguments correct on first go, but miss them on second go. Since I know absolutely no ruby (just discovered puts :D) I can't really find out anything more to troubleshoot me. Any ideas?

can't compile

compilation fails with:

/usr/lib/ruby/1.9.1/json/common.rb:148:in `parse': 743: unexpected token at 'OSError: [Errno 8] Exec format error' (JSON::ParserError)
    from /usr/lib/ruby/1.9.1/json/common.rb:148:in `parse'
    from /home/epegzz/.gem/ruby/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in `generate'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from /home/epegzz/.gem/ruby/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:in `compile'
    from /home/epegzz/.gem/ruby/1.9.1/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in `compile'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
    from /home/epegzz/.gem/ruby/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from /home/epegzz/.gem/ruby/1.9.1/gems/fontcustom-0.0.2/bin/fontcustom:5:in `<top (required)>'
    from /home/epegzz/.gem/ruby/1.9.1/bin/fontcustom:23:in `load'
    from /home/epegzz/.gem/ruby/1.9.1/bin/fontcustom:23:in `<main>'

Multiple errors installing gem

Homebrew portion went smoothly, but installing the gem yields multiple errors:

Building native extensions. This could take a while... ERROR: Error installing fontcustom: ERROR: Failed to build gem native extension.

Then a moment later:

Error: could not stat active Xcode path '/Applications/Xcode46-DP3.app/Contents/Developer'. (No such file or directory) error: no such file or directory: 'generator.o'

Any idea what's going on here?

Feature Request: Add a compile config to svg directory

I think it'd be nice to have some sort of config in the folder with svgs that would auto-populate the compile parameters. I have all the svgs in git so that when I make a change I still have the source files around but it always takes a bit of digging around to figure out the compile params I use. It'd be nice if these could be set-and-forget.

SVG files with <switch> tag won't compile

After exporting SVG files from Adobe Illustrator, I noticed that these SVG files would not compile. After long troubleshooting/debugging and different export options, I found out that if I only manually removed that tag from within the SVG file, it would compile perfectly.

Solution option 1:
Rewrite the compile script so that it does not ignore what is inside the tag.

Solution option 2 (hacky):
Rewrite the compile script so that it removes the lines/strings "< switch >" and "</ switch >" from the svg files permanently. (I did it, and it works for me)

Compiling of Inkscape SVG's ok, but no icons are shown in the browser afterwards

I created some SVGs with Inkscape 0.48. After i compiled these with fontcustom it created all the files as you can see here:

But after opening the test.html no icons are displayed :(

The SVG's are available as a git repo and can be found here. I guess they are ok, aren't they?

And here are my compiled files.

Some information about my local machine:

  • Ubuntu 12.04
  • Installed without ttfautohint! But it has to be working without it too, right?
  • Inkscape 0.48 for SVG generation
  • Tried viewing in browser with Chrome 23 and Firefox 11

Provide a custom namespace

I use twitter-bootstrap-rails which has its own overrides. It would be nice, we can use a user defined name space. So we can have:

myapp-icon-

instead of

myapp-icon-

undefined method `chomp`

$ fontcustom compile /var/www/icontest/
      remove  /var/www/fontcustom/fontcustom.css
/usr/local/lib/ruby/gems/1.9.1/gems/fontcustom-0.1.1/lib/fontcustom/generator.rb:72:in `show_paths': undefined method `chomp' for nil:NilClass (NoMethodError)
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
        from /usr/local/lib/ruby/gems/1.9.1/gems/fontcustom-0.1.1/lib/fontcustom.rb:9:in `compile'
        from /usr/local/lib/ruby/gems/1.9.1/gems/fontcustom-0.1.1/lib/fontcustom/cli.rb:15:in `compile'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
        from /usr/local/lib/ruby/gems/1.9.1/gems/fontcustom-0.1.1/bin/fontcustom:5:in `<top (required)>'
        from /usr/local/bin/fontcustom:23:in `load'
        from /usr/local/bin/fontcustom:23:in `<main>'

Fixed by editing this file:

/usr/local/lib/ruby/gems/1.9.1/gems/fontcustom-0.1.1/lib/fontcustom/generator.rb

from

def show_paths
  file = Dir[File.join(@output, @name + '*.ttf')].first
  @path = file.chomp('.ttf')

  ['woff','ttf','eot','svg'].each do |type|
    say_status(:create, @path + '.' + type)
  end
end

to

def show_paths
  file = Dir[File.join(@output, @name + '*.ttf')].first
  if file
    @path = file.chomp('.ttf')
  else
    @path = File.join(@output, @name)
  end

  ['woff','ttf','eot','svg'].each do |type|
    say_status(:create, @path + '.' + type)
  end
end

Take it with a grain of salt, I am not a ruby programmer.

Use fontcustom in larger project

I'm working on a way to build a custom font with glyphs that I provide. How would I go about using this in a larger Sinatra web based project running on Heroku?

Would it be as simple as including the gem in my gemfile? I'm fairly new to Ruby dev so please forgive me if this is a n00b question.

Undefined variable: import'

I didn't get the gem to run.

My system:

  • Mac OS X 10.7.5
  • ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
  • gem version 1.8.24
  • fontforge 20110222
  • libfontforge 20110222-ML

Error message:

/Library/Ruby/Gems/1.8/gems/json-1.7.5/lib/json/common.rb:155:in `parse': 757: unexpected token at 'Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/scripts/generate.py line: 2 Undefined variable: import' (JSON::ParserError)
from /Library/Ruby/Gems/1.8/gems/json-1.7.5/lib/json/common.rb:155:in `parse'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/generator.rb:40:in `generate'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `send'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/shell.rb:14:in `map'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/core_ext/ordered_hash.rb:75:in `each'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom.rb:13:in `compile'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/lib/fontcustom/cli.rb:8:in `compile'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `send'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /Library/Ruby/Gems/1.8/gems/fontcustom-0.0.2/bin/fontcustom:5
from /usr/bin/fontcustom:23:in `load'
from /usr/bin/fontcustom:23

add ligature support

I'm keen on getting ligature support implemented in fontcustom, as Webkit doesn't currently support CSS transitions on :before elements and I find it cumbersome to have to use UTF8 characters like &#xf100 in my HTML code. I peeked around a little in the fontforge docs, but it didn't seem immediately obvious how to go about adding ligatures. Have you guys looked into it much?

In the implementation I'm imaginging, the ligatures would be determined by the original SVG filenames, e.g. foo.svg becomes foo.

Here's my interim workaround:

# This helper is a stand-in until one of these problems is fixed:
# 
#1. fontcustom supports ligatures
#2. webkit supports CSS transitions on :before elements
def icon_for(word)
  words = %w(fukuoka github moon sun twitter)
  return "?" unless words.include?(word.to_s)
  "&#xf#{100 + words.index(word.to_s)}".html_safe
end

Windows Support

Windows has Font Forge Support but it isn't immediately obvious how to make FontForge support available to Python so that FontCustom will work seamlessly cross-platform. I realize that this could be seen as a FontForge issue, not a FontCustom issue, but a workaround is likely possible.

http://www.mpetroff.net/software/fontforge-windows/

installation on ubuntu fails without dev package

On installing the gem on a system with ruby 1.9.1 set up the installation fails with the error:

Building native extensions.  This could take a while...
ERROR:  Error installing fontcustom:
    ERROR: Failed to build gem native extension.
        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'

After installing the -dev package for ruby installation works:

sudo apt-get install ruby1.9.1-dev

Should be noted somewhere, thank you :)

Feature Request: Allow Sass Output or Allow output of css unicode classes

I want to import this file into my project which uses Sass, and sass is fast becoming a standard in web development. I want to express my interest in having fontcustom output sass file or even just allow me to only get the outputted css class names like:

.icon-expand-up-arrow:before { content: "\f100"; }

without the bootstrap css being added.

Thank you for your development effort!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.