svg2glyph 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/svg2glyph +22 -0
- metadata +49 -0
data/bin/svg2glyph
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
source_file = ARGV[0].nil? ? 'source.xml' : ARGV[0]
|
5
|
+
target_dir = ARGV[1].nil? ? 'glyphs' : ARGV[1]
|
6
|
+
|
7
|
+
abort("The specified svg file does not exist: #{source_file}") unless File.exists? source_file
|
8
|
+
|
9
|
+
FileUtils.mkdir_p target_dir unless Dir.exists? target_dir
|
10
|
+
|
11
|
+
File.open(source_file).read.scan(/id="(.*?)".*?d="(.*?)"/m) do |m|
|
12
|
+
File.open("#{target_dir}/#{m[0]}.svg", "w+") do |out|
|
13
|
+
out.write <<eos
|
14
|
+
<?xml version="1.0" encoding="utf-8"?>
|
15
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
16
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1000px"
|
17
|
+
height="1000px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
18
|
+
<path d="#{m[1]}" />
|
19
|
+
</svg>
|
20
|
+
eos
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: svg2glyph
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mark Ross
|
9
|
+
- James Maroney
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-06-01 00:00:00.000000000Z
|
14
|
+
dependencies: []
|
15
|
+
description: This gem consumes an SVG document created in Illustrator and generates
|
16
|
+
individual glyph files for each named group. Intended for use with hieroglyph.
|
17
|
+
email:
|
18
|
+
executables:
|
19
|
+
- svg2glyph
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- bin/svg2glyph
|
24
|
+
homepage:
|
25
|
+
licenses: []
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 1.8.10
|
45
|
+
signing_key:
|
46
|
+
specification_version: 3
|
47
|
+
summary: This gem consumes an SVG document created in Illustrator and generates individual
|
48
|
+
glyph files for each named group. Intended for use with hieroglyph.
|
49
|
+
test_files: []
|