module HexaPDF::FontLoader::FromFile
def self.call(document, name, subset: true, **)
+subset+::
The file name or a HexaPDF::Font::TrueType::Font object.
+file_name+/+font_object+::
The PDF document to associate the font wrapper with.
+document+::
font file.
documents always refer to the same font, the second form is better to avoid re-parsing the
The first form using a file name is easier to use in one-off cases. However, if multiple
needed must be closed by the caller once the font is not needed anymore.
If a file name is given, the file object representing the font file is *not* closed and if
Returns an appropriate font wrapper for the given file name or TrueType font object.
FromFile.call(document, font_object, subset: true, **) -> wrapped_font
FromFile.call(document, file_name, subset: true, **) -> wrapped_font
:call-seq:
def self.call(document, name, subset: true, **) is_font = name.kind_of?(HexaPDF::Font::TrueType::Font) return nil unless is_font || File.file?(name) font = is_font ? name : HexaPDF::Font::TrueType::Font.new(File.open(name, 'rb')) HexaPDF::Font::TrueTypeWrapper.new(document, font, subset: subset) end