# File lib/ttfunk.rb, line 14 def self.from_dfont(file, which=0) new(ResourceFile.open(file) { |dfont| dfont["sfnt", which] }) end
# File lib/ttfunk.rb, line 18 def initialize(contents) @contents = StringIO.new(contents) @directory = Directory.new(@contents) end
# File lib/ttfunk.rb, line 10 def self.open(file) new(::File.open(file, "rb") { |f| f.read }) end
# File lib/ttfunk.rb, line 24 def ascent @ascent ||= (os2.exists? && os2.ascent && os2.ascent.nonzero?) || horizontal_header.ascent end
# File lib/ttfunk.rb, line 36 def bbox [header.x_min, header.y_min, header.x_max, header.y_max] end
# File lib/ttfunk.rb, line 49 def cmap @cmap ||= TTFunk::Table::Cmap.new(self) end
# File lib/ttfunk.rb, line 28 def descent @descent ||= (os2.exists? && os2.descent && os2.descent.nonzero?) || horizontal_header.descent end
# File lib/ttfunk.rb, line 41 def directory_info(tag) directory.tables[tag.to_s] end
# File lib/ttfunk.rb, line 81 def glyph_locations @glyph_locations ||= TTFunk::Table::Loca.new(self) end
# File lib/ttfunk.rb, line 85 def glyph_outlines @glyph_outlines ||= TTFunk::Table::Glyf.new(self) end
# File lib/ttfunk.rb, line 45 def header @header ||= TTFunk::Table::Head.new(self) end
# File lib/ttfunk.rb, line 53 def horizontal_header @horizontal_header ||= TTFunk::Table::Hhea.new(self) end
# File lib/ttfunk.rb, line 57 def horizontal_metrics @horizontal_metrics ||= TTFunk::Table::Hmtx.new(self) end
# File lib/ttfunk.rb, line 65 def kerning @kerning ||= TTFunk::Table::Kern.new(self) end
# File lib/ttfunk.rb, line 32 def line_gap @line_gap ||= (os2.exists? && os2.line_gap && os2.line_gap.nonzero?) || horizontal_header.line_gap end
# File lib/ttfunk.rb, line 61 def maximum_profile @maximum_profile ||= TTFunk::Table::Maxp.new(self) end
# File lib/ttfunk.rb, line 69 def name @name ||= TTFunk::Table::Name.new(self) end
# File lib/ttfunk.rb, line 73 def os2 @os2 ||= TTFunk::Table::OS2.new(self) end
# File lib/ttfunk.rb, line 77 def postscript @postscript ||= TTFunk::Table::Post.new(self) end