lib/hexapdf/font_loader/from_configuration.rb in hexapdf-0.2.0 vs lib/hexapdf/font_loader/from_configuration.rb in hexapdf-0.3.0

- old
+ new

@@ -2,11 +2,11 @@ # #-- # This file is part of HexaPDF. # # HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby -# Copyright (C) 2016 Thomas Leitner +# Copyright (C) 2014-2017 Thomas Leitner # # HexaPDF is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License version 3 as # published by the Free Software Foundation with the addition of the # following permission added to Section 15 as permitted in Section 7(a): @@ -50,19 +50,22 @@ # +name+:: # The name of the font. # # +variant+:: # The font variant. Normally one of :none, :bold, :italic, :bold_italic. - def self.call(document, name, variant: :none, **) + # + # +subset+:: + # 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" end font = HexaPDF::Font::TrueType::Font.new(File.open(file)) - HexaPDF::Font::TrueTypeWrapper.new(document, font) + HexaPDF::Font::TrueTypeWrapper.new(document, font, subset: subset) end end end