ttfunk 1.1.1 → 1.2.0

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: 596be40a24b1e068cc873b81efdd04f45e19543e
4
- data.tar.gz: 893416a4ed60ddf229f96e675076edfc155614dc
3
+ metadata.gz: 7b030c6811fe1baead702701c897e1e01484e93d
4
+ data.tar.gz: 58726bbfff5fe6e77e030e9f8a680360d2660020
5
5
  SHA512:
6
- metadata.gz: 65ab47ef940dbe336145845f9be97a38e10d0113f39a5fcb6a42e9e1d20dfa81e392a989b748a736fef2356fe44e0903c05ced2fe74dbe4242f6f6c2edd24203
7
- data.tar.gz: 39081ad4c56596a2506f5484de2d9ac7f528504015cfb4c2353d612e402e8f3792449e44727bf19b441ed0baa9117c14eaf76a2028b535ea1cec113218658f03
6
+ metadata.gz: 1002259a2d5e477c3db1e580c284184540edd80d75287afda440d66713998668e3d0b72905c16878176d87daa4d7ff271e0f00ff602f7804c4b5d3a6c1ce9d73
7
+ data.tar.gz: b11b2d87f9a2a9599cee93625f0260da5b45db9413d837d724b533e048416bb9fb70bb26c0a5a1f0e8cb832e0cd492b46db29a4c3d6e018c541905cde88903a4
data/README.rdoc CHANGED
@@ -19,33 +19,18 @@ Basic usage:
19
19
 
20
20
  For more detailed examples, explore the examples directory.
21
21
 
22
- = Maintainers
23
-
24
- - Gregory Brown
25
- - Brad Ediger
26
- - Daniel Nelson
27
- - Jonathan Greenberg
28
- - James Healy
29
-
30
22
  = Licensing
31
23
 
32
24
  Matz's terms for Ruby, GPLv2, or GPLv3. See LICENSE for details.
33
25
 
34
26
  = Authorship
35
27
 
36
- ttfunk was originally developed by Gregory Brown as part of the Prawn
37
- project. In 2010, Gregory officially handed the project off to the Prawn core
38
- team. Currently active maintainers include Brad Ediger, Daniel Nelson, James
39
- Healy, and Jonathan Greenberg.
40
-
41
- While he was only with us for a short time before moving on to other things,
42
- we'd also like to thank Prawn core team emeritus Jamis Buck for his
43
- contributions.
28
+ This project is maintained by the same folks who run the Prawn PDF project.
44
29
 
45
30
  You can find the full list of Github users who have at least one patch accepted
46
31
  to ttfunk at:
47
32
 
48
- https://github.com/sandal/ttfunk/contributors
33
+ https://github.com/prawnpdf/ttfunk/contributors
49
34
 
50
35
  = Mailing List
51
36
 
data/lib/ttfunk.rb CHANGED
@@ -7,14 +7,33 @@ module TTFunk
7
7
  attr_reader :contents
8
8
  attr_reader :directory
9
9
 
10
- def self.open(file)
11
- new(::File.open(file, "rb") { |f| f.read })
10
+ def self.open(io_or_path)
11
+ new verify_and_open(io_or_path).read
12
12
  end
13
13
 
14
14
  def self.from_dfont(file, which=0)
15
15
  new(ResourceFile.open(file) { |dfont| dfont["sfnt", which] })
16
16
  end
17
17
 
18
+ def self.verify_and_open(io_or_path)
19
+ # File or IO
20
+ if io_or_path.respond_to?(:rewind)
21
+ io = io_or_path
22
+ # Rewind if the object we're passed is an IO, so that multiple embeds of
23
+ # the same IO object will work
24
+ io.rewind
25
+ # read the file as binary so the size is calculated correctly
26
+ # guard binmode because some objects acting io-like don't implement it
27
+ io.binmode if io.respond_to?(:binmode)
28
+ return io
29
+ end
30
+ # String or Pathname
31
+ io_or_path = Pathname.new(io_or_path)
32
+ raise ArgumentError, "#{io_or_path} not found" unless io_or_path.file?
33
+ io = io_or_path.open('rb')
34
+ io
35
+ end
36
+
18
37
  def initialize(contents)
19
38
  @contents = StringIO.new(contents)
20
39
  @directory = Directory.new(@contents)
@@ -115,7 +115,7 @@ module TTFunk
115
115
  @designer_url = @strings[12]
116
116
  @license = @strings[13]
117
117
  @license_url = @strings[14]
118
- @preferred_family = @strings[15]
118
+ @preferred_family = @strings[16]
119
119
  @preferred_subfamily = @strings[17]
120
120
  @compatible_full = @strings[18]
121
121
  @sample_text = @strings[19]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttfunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-02-24 00:00:00.000000000 Z
15
+ date: 2014-06-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rdoc
@@ -56,7 +56,21 @@ dependencies:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
- description: Get Ya TrueType Funk On! (Font Metrics Parser for Prawn)
59
+ - !ruby/object:Gem::Dependency
60
+ name: rubocop
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '='
64
+ - !ruby/object:Gem::Version
65
+ version: 0.20.1
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '='
71
+ - !ruby/object:Gem::Version
72
+ version: 0.20.1
73
+ description: Font Metrics Parser for the Prawn PDF generator
60
74
  email:
61
75
  - gregory.t.brown@gmail.com
62
76
  - brad@bradediger.com