Module: HexaPDF::FontLoader::FromFile
- Defined in:
- lib/hexapdf/font_loader/from_file.rb
Overview
This module interprets the font name as file name and tries to load it.
Class Method Summary collapse
-
.call(document, name, subset: true) ⇒ Object
Loads the given font by interpreting the font name as file name.
Class Method Details
.call(document, name, subset: true) ⇒ Object
Loads the given font by interpreting the font name as file name.
The file object representing the font file is not closed and if needed must be closed by the caller once the font is not needed anymore.
document-
The PDF document to associate the font object with.
name-
The file name.
subset-
Specifies whether the font should be subset if possible.
55 56 57 58 59 60 |
# File 'lib/hexapdf/font_loader/from_file.rb', line 55 def self.call(document, name, subset: true, **) return nil unless File.file?(name) font = HexaPDF::Font::TrueType::Font.new(File.open(name, 'rb')) HexaPDF::Font::TrueTypeWrapper.new(document, font, subset: subset) end |