Object
# File lib/ttfunk.rb, line 15 def self.from_dfont(file, which=0) new(ResourceFile.open(file) { |dfont| dfont["sfnt", which] }) end
# File lib/ttfunk.rb, line 38 def initialize(contents) @contents = StringIO.new(contents) @directory = Directory.new(@contents) end
# File lib/ttfunk.rb, line 11 def self.open(io_or_path) new verify_and_open(io_or_path).read end
# File lib/ttfunk.rb, line 19 def self.verify_and_open(io_or_path) # File or IO if io_or_path.respond_to?(:rewind) io = io_or_path # Rewind if the object we're passed is an IO, so that multiple embeds of # the same IO object will work io.rewind # read the file as binary so the size is calculated correctly # guard binmode because some objects acting io-like don't implement it io.binmode if io.respond_to?(:binmode) return io end # String or Pathname io_or_path = Pathname.new(io_or_path) raise ArgumentError, "#{io_or_path} not found" unless io_or_path.file? io = io_or_path.open('rb') io end
# File lib/ttfunk.rb, line 44 def ascent @ascent ||= (os2.exists? && os2.ascent && os2.ascent.nonzero?) || horizontal_header.ascent end
# File lib/ttfunk.rb, line 56 def bbox [header.x_min, header.y_min, header.x_max, header.y_max] end
# File lib/ttfunk.rb, line 69 def cmap @cmap ||= TTFunk::Table::Cmap.new(self) end
# File lib/ttfunk.rb, line 48 def descent @descent ||= (os2.exists? && os2.descent && os2.descent.nonzero?) || horizontal_header.descent end
# File lib/ttfunk.rb, line 61 def directory_info(tag) directory.tables[tag.to_s] end
# File lib/ttfunk.rb, line 101 def glyph_locations @glyph_locations ||= TTFunk::Table::Loca.new(self) end
# File lib/ttfunk.rb, line 105 def glyph_outlines @glyph_outlines ||= TTFunk::Table::Glyf.new(self) end
# File lib/ttfunk.rb, line 65 def header @header ||= TTFunk::Table::Head.new(self) end
# File lib/ttfunk.rb, line 73 def horizontal_header @horizontal_header ||= TTFunk::Table::Hhea.new(self) end
# File lib/ttfunk.rb, line 77 def horizontal_metrics @horizontal_metrics ||= TTFunk::Table::Hmtx.new(self) end
# File lib/ttfunk.rb, line 85 def kerning @kerning ||= TTFunk::Table::Kern.new(self) end
# File lib/ttfunk.rb, line 52 def line_gap @line_gap ||= (os2.exists? && os2.line_gap && os2.line_gap.nonzero?) || horizontal_header.line_gap end
# File lib/ttfunk.rb, line 81 def maximum_profile @maximum_profile ||= TTFunk::Table::Maxp.new(self) end
# File lib/ttfunk.rb, line 89 def name @name ||= TTFunk::Table::Name.new(self) end
Generated with the Darkfish Rdoc Generator 2.