blacksmith 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -5
- data/README.md +1 -1
- data/bin/blacksmith +4 -0
- data/examples/forgefile/Forgefile +4 -0
- data/examples/{forging_fonts.rb → programmatic_font_creation/programmatic_font_creation.rb} +1 -0
- data/lib/blacksmith.rb +8 -6
- data/lib/blacksmith/font_builder.rb +15 -5
- data/lib/blacksmith/version.rb +1 -1
- metadata +6 -3
data/.gitignore
CHANGED
@@ -18,8 +18,9 @@ test/version_tmp
|
|
18
18
|
tmp
|
19
19
|
|
20
20
|
.DS_Store
|
21
|
-
examples
|
22
|
-
examples
|
23
|
-
examples
|
24
|
-
examples
|
25
|
-
examples
|
21
|
+
examples/**/*.ttf
|
22
|
+
examples/**/*.svg
|
23
|
+
examples/**/*.afm
|
24
|
+
examples/**/*.eot
|
25
|
+
examples/**/*.woff
|
26
|
+
!examples/glyphs/*.svg
|
data/README.md
CHANGED
data/bin/blacksmith
ADDED
data/lib/blacksmith.rb
CHANGED
@@ -10,7 +10,13 @@ class Blacksmith
|
|
10
10
|
class DependencyMissing < Error; end
|
11
11
|
|
12
12
|
class << self
|
13
|
-
|
13
|
+
|
14
|
+
def run(args = [])
|
15
|
+
if args.empty?
|
16
|
+
new(File.join(Dir.pwd, 'Forgefile')).forge
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
def forge(*args, &block)
|
15
21
|
new(*args, &block).forge
|
16
22
|
end
|
@@ -26,7 +32,7 @@ class Blacksmith
|
|
26
32
|
end
|
27
33
|
|
28
34
|
def initialize(filename = nil, &block)
|
29
|
-
@font =
|
35
|
+
@font = FontBuilder.execute(filename, &block)
|
30
36
|
end
|
31
37
|
|
32
38
|
def forge
|
@@ -41,10 +47,6 @@ class Blacksmith
|
|
41
47
|
|
42
48
|
attr_reader :font
|
43
49
|
|
44
|
-
def build_font(&block)
|
45
|
-
FontBuilder.execute(&block)
|
46
|
-
end
|
47
|
-
|
48
50
|
def check_environment
|
49
51
|
FontForge.check_dependency!
|
50
52
|
TTFAutoHint.check_dependency!
|
@@ -1,21 +1,31 @@
|
|
1
1
|
class Blacksmith::FontBuilder
|
2
2
|
class << self
|
3
3
|
|
4
|
-
def execute(&block)
|
5
|
-
new(&block).execute
|
4
|
+
def execute(*args, &block)
|
5
|
+
new(*args, &block).execute
|
6
6
|
end
|
7
7
|
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(&block)
|
11
|
-
|
10
|
+
def initialize(filename = nil, &block)
|
11
|
+
raise "Expects filename or block" unless filename || block
|
12
|
+
raise "Expects either a block or a filename - not both" if filename and block
|
13
|
+
raise "File not found: #{filename}" unless filename && File.exist?(filename)
|
14
|
+
|
15
|
+
@_instructions = block || File.read(filename)
|
16
|
+
|
12
17
|
@_attributes = {}
|
13
18
|
@_glyphs = {}
|
14
19
|
@_source = '.'
|
15
20
|
end
|
16
21
|
|
17
22
|
def execute
|
18
|
-
|
23
|
+
case @_instructions
|
24
|
+
when String
|
25
|
+
instance_eval(@_instructions)
|
26
|
+
when Proc
|
27
|
+
instance_eval(&@_instructions)
|
28
|
+
end
|
19
29
|
|
20
30
|
font = Blacksmith::Font.new(@_attributes)
|
21
31
|
|
data/lib/blacksmith/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -30,7 +30,8 @@ dependencies:
|
|
30
30
|
description:
|
31
31
|
email:
|
32
32
|
- me@t6d.de
|
33
|
-
executables:
|
33
|
+
executables:
|
34
|
+
- blacksmith
|
34
35
|
extensions: []
|
35
36
|
extra_rdoc_files: []
|
36
37
|
files:
|
@@ -39,9 +40,11 @@ files:
|
|
39
40
|
- LICENSE
|
40
41
|
- README.md
|
41
42
|
- Rakefile
|
43
|
+
- bin/blacksmith
|
42
44
|
- blacksmith.gemspec
|
43
|
-
- examples/
|
45
|
+
- examples/forgefile/Forgefile
|
44
46
|
- examples/glyphs/star.svg
|
47
|
+
- examples/programmatic_font_creation/programmatic_font_creation.rb
|
45
48
|
- lib/blacksmith.rb
|
46
49
|
- lib/blacksmith/executable.rb
|
47
50
|
- lib/blacksmith/font.rb
|