hershey 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10097f542216baf82422f0bce7fc3abe566e7ec2
4
- data.tar.gz: 6346f8c569ca2200bcacaf96af06ef6b3ca00752
3
+ metadata.gz: 8b66efface3022d72fefa4018088205dac320f54
4
+ data.tar.gz: 44954d2d7e45d07e1e336b308edf6f90e6964e46
5
5
  SHA512:
6
- metadata.gz: ec3d3263b9894a4f28c04160ce8c8e6d354be89add3f8bbcd34c3399a0855c728ab6cea4e7737271c70012e24bc7c7b2952a522341155de1ce4a44798ed825bd
7
- data.tar.gz: 05e978ec1892bbe1931bb5ab913006dd0aa2409665f28b1918cbd11cdf7bca6792cd8cf8c6165d5d50990c79826e7126bd62183083255ab33ef8327792b10515
6
+ metadata.gz: b956249989149548c9fcd40c1c04d56039484527766385489e0a90122f74372d2821d80d368b4d9c5e0f4f87c0d0caec48143c440cfe4b69e8b768457955fb9b
7
+ data.tar.gz: 400c6362d3ed6ae09c09237c9cb4225904123fd48303eb6af941bdf4a8ed88cbb83cef3d2ccb3eff7b5d3c8a46a9fd37e778167257e94cc6d2678fcd23a52cb5
data/bin/hershey ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'hershey'
4
+
5
+ file = ARGV.shift
6
+ width = ARGV.shift
7
+ text = ARGV.join(' ')
8
+
9
+ open(file, 'w') {|f| f.write(Hershey.svg(text, width: width))}
data/hershey.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["me@winstondurand.com"]
11
11
  spec.summary = %q{Generates an SVG with text using the Hershey Vector Font}
12
12
  # spec.description = %q{TODO: Write a longer description. Optional.}
13
- # spec.homepage = ""
13
+ spec.homepage = "https://github.com/R167/hershey"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
data/lib/hershey.rb CHANGED
@@ -6,4 +6,9 @@ require_relative "hershey/version"
6
6
  require_relative "hershey/word"
7
7
 
8
8
  module Hershey
9
+ def self.svg(text, options = {})
10
+ doc = Document.new(options)
11
+ doc.write(text)
12
+ doc.svg
13
+ end
9
14
  end
@@ -4,7 +4,7 @@ module Hershey
4
4
  SIDE = 10.freeze
5
5
  HEIGHT_STRING = "jfdsklahfdjksjhaljfdskahj".freeze
6
6
 
7
- def initialize(width: 500, height: 500, spacing: 3, vertical: 20)
7
+ def initialize(width: 500, height: 500, spacing: 3, vertical: 20, font: :futural)
8
8
  @words = []
9
9
  @pages = []
10
10
  @width = width
@@ -13,6 +13,7 @@ module Hershey
13
13
  @line = BUFFER
14
14
  @vertical = vertical
15
15
  @closed = false
16
+ @font = font
16
17
  @svg = <<-HEADER
17
18
  <?xml version="1.0" standalone="no"?>
18
19
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
@@ -24,7 +25,7 @@ module Hershey
24
25
 
25
26
  def <<(text)
26
27
  text.split(' ').each do |word|
27
- @words << Word.new(word)
28
+ @words << Word.new(word, font: @font)
28
29
  end
29
30
  end
30
31
 
@@ -1,3 +1,3 @@
1
1
  module Hershey
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hershey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winston Durand
@@ -55,7 +55,8 @@ dependencies:
55
55
  description:
56
56
  email:
57
57
  - me@winstondurand.com
58
- executables: []
58
+ executables:
59
+ - hershey
59
60
  extensions: []
60
61
  extra_rdoc_files: []
61
62
  files:
@@ -64,6 +65,7 @@ files:
64
65
  - LICENSE.txt
65
66
  - README.md
66
67
  - Rakefile
68
+ - bin/hershey
67
69
  - hershey.gemspec
68
70
  - lib/hershey.rb
69
71
  - lib/hershey/character.rb
@@ -72,7 +74,7 @@ files:
72
74
  - lib/hershey/page.rb
73
75
  - lib/hershey/version.rb
74
76
  - lib/hershey/word.rb
75
- homepage:
77
+ homepage: https://github.com/R167/hershey
76
78
  licenses:
77
79
  - MIT
78
80
  metadata: {}