Sha256: e4f3d8b5cdb3bb4c052874e5aa5e45bfa4af937cb59b76da41ee01bc1e2a2935
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
require 'prawn/font/ttf' module Prawn class Font class DFont < TTF # Returns a list of the names of all named fonts in the given dfont file. # Note that fonts are not required to be named in a dfont file, so the # list may be empty even if the file does contain fonts. Also, note that # the list is returned in no particular order, so the first font in the # list is not necessarily the font at index 0 in the file. # def self.named_fonts(file) TTFunk::ResourceFile.open(file) do |f| return f.resources_for("sfnt") end end # Returns the number of fonts contained in the dfont file. # def self.font_count(file) TTFunk::ResourceFile.open(file) do |f| return f.map["sfnt"][:list].length end end private def read_ttf_file TTFunk::File.from_dfont(@name, @options[:font] || 0) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn-graph-0.0.2 | vendor/prawn-core/lib/prawn/font/dfont.rb |
prawn-graph-0.0.1 | vendor/prawn-core/lib/prawn/font/dfont.rb |