1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
# Copyright (c) 2011-2017 NAITOH Jun
# Released under the MIT license
# http://www.opensource.org/licenses/MIT
module RBPDFFontDescriptor
@@descriptors = { 'freesans' => {} }
@@font_name = 'freesans'
def self.font(font_name)
@@descriptors[font_name.gsub(".rb", "")]
end
def self.define(font_name = 'freesans')
@@descriptors[font_name] ||= {}
yield @@descriptors[font_name]
end
#
# Return fonts path
#
def self.getfontpath()
# Is it in this plugin's font folder?
fpath = File.join File.dirname(__FILE__), 'fonts'
if File.exist?(fpath)
return fpath
end
# Could not find it.
nil
end
end
|