Sha256: 17d74722d4c3f8e602ec7a741fcab9a27ed484ddf97065cb4f28a29906851f92
Contents?: true
Size: 1017 Bytes
Versions: 11
Compression:
Stored size: 1017 Bytes
Contents
# -*- encoding: utf-8 -*- require 'test_helper' require 'hexapdf/font_loader' require 'hexapdf/document' describe HexaPDF::FontLoader::FromConfiguration do before do @doc = HexaPDF::Document.new font_file = File.join(TEST_DATA_DIR, "fonts", "Ubuntu-Title.ttf") @doc.config['font.map'] = {'font' => {none: font_file}} @klass = HexaPDF::FontLoader::FromConfiguration end it "loads the configured font" do wrapper = @klass.call(@doc, "font") assert_equal("Ubuntu-Title", wrapper.wrapped_font.font_name) end it "passes the subset value to the wrapper" do wrapper = @klass.call(@doc, "font") assert(wrapper.subset?) wrapper = @klass.call(@doc, "font", subset: false) refute(wrapper.subset?) end it "fails if the font file cannot be read" do @doc.config['font.map']['font'][:none] << "unknown" assert_raises(HexaPDF::Error) { @klass.call(@doc, "font") } end it "returns nil for unknown fonts" do assert_nil(@klass.call(@doc, "Unknown")) end end
Version data entries
11 entries across 11 versions & 1 rubygems