Class: TTFunk::Table
- Inherits:
-
Object
- Object
- TTFunk::Table
- Includes:
- Reader
- Defined in:
- lib/ttfunk/table.rb,
lib/ttfunk/table/os2.rb,
lib/ttfunk/table/cmap.rb,
lib/ttfunk/table/glyf.rb,
lib/ttfunk/table/head.rb,
lib/ttfunk/table/hhea.rb,
lib/ttfunk/table/hmtx.rb,
lib/ttfunk/table/kern.rb,
lib/ttfunk/table/loca.rb,
lib/ttfunk/table/maxp.rb,
lib/ttfunk/table/name.rb,
lib/ttfunk/table/post.rb,
lib/ttfunk/table/simple.rb,
lib/ttfunk/table/glyf/simple.rb,
lib/ttfunk/table/kern/format0.rb,
lib/ttfunk/table/cmap/format00.rb,
lib/ttfunk/table/cmap/format04.rb,
lib/ttfunk/table/cmap/format06.rb,
lib/ttfunk/table/cmap/format10.rb,
lib/ttfunk/table/cmap/format12.rb,
lib/ttfunk/table/cmap/subtable.rb,
lib/ttfunk/table/glyf/compound.rb,
lib/ttfunk/table/post/format10.rb,
lib/ttfunk/table/post/format20.rb,
lib/ttfunk/table/post/format30.rb,
lib/ttfunk/table/post/format40.rb
Defined Under Namespace
Classes: Cmap, Glyf, Head, Hhea, Hmtx, Kern, Loca, Maxp, Name, OS2, Post, Simple
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(file) ⇒ Table
constructor
A new instance of Table.
- #raw ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(file) ⇒ Table
Returns a new instance of Table.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ttfunk/table.rb', line 11 def initialize(file) @file = file info = file.directory_info(tag) if info @offset = info[:offset] @length = info[:length] parse_from(@offset) { parse! } end end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/ttfunk/table.rb', line 7 def file @file end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
9 10 11 |
# File 'lib/ttfunk/table.rb', line 9 def length @length end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
8 9 10 |
# File 'lib/ttfunk/table.rb', line 8 def offset @offset end |
Instance Method Details
#exists? ⇒ Boolean
24 25 26 |
# File 'lib/ttfunk/table.rb', line 24 def exists? !@offset.nil? end |
#raw ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ttfunk/table.rb', line 28 def raw if exists? parse_from(offset) { io.read(length) } else nil end end |
#tag ⇒ Object
36 37 38 |
# File 'lib/ttfunk/table.rb', line 36 def tag self.class.name.split(/::/).last.downcase end |