lib/hexapdf/font_loader/from_configuration.rb in hexapdf-0.14.0 vs lib/hexapdf/font_loader/from_configuration.rb in hexapdf-0.14.1
- old
+ new
@@ -61,11 +61,11 @@
# Specifies whether the font should be subset if possible.
def self.call(document, name, variant: :none, subset: true)
file = document.config['font.map'].dig(name, variant)
return nil if file.nil?
- unless File.file?(file)
- raise HexaPDF::Error, "The configured font file #{file} does not exist"
+ unless file.kind_of?(HexaPDF::Font::TrueType::Font) || File.file?(file)
+ raise HexaPDF::Error, "The configured font file #{file} is not a valid value"
end
FromFile.call(document, file, subset: subset)
end
# Returns a hash of the form 'font_name => [variants, ...]' of the configured fonts.