Sha256: 9cf9e6bdef38bb677e106cb2462cfad6ebf9d036efb2758571028f4ffa3a510e

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'stringio'
require 'test_helper'
require 'hexapdf/font/true_type'

describe HexaPDF::Font::TrueType::Optimizer do
  before do
    font_file = File.join(TEST_DATA_DIR, "fonts", "Ubuntu-Title.ttf")
    @font = HexaPDF::Font::TrueType::Font.new(File.open(font_file))
    @subsetter = HexaPDF::Font::TrueType::Subsetter.new(@font)
  end

  after do
    @font.io.close
  end

  describe "build_for_pdf" do
    it "builds a font file that is optimized for use with PDFs" do
      font_data = HexaPDF::Font::TrueType::Optimizer.build_for_pdf(@font)
      built_font = HexaPDF::Font::TrueType::Font.new(StringIO.new(font_data))
      %I(FFTM GDEF GPOS GSUB name post).each do |table|
        refute(built_font[table])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hexapdf-0.6.0 test/hexapdf/font/true_type/test_optimizer.rb
hexapdf-0.5.0 test/hexapdf/font/true_type/test_optimizer.rb
hexapdf-0.4.0 test/hexapdf/font/true_type/test_optimizer.rb