Sha256: 78c9f68cdc57b1b7fa688a7e8534ba703931a4690e55dde63867c93647797d3c

Contents?: true

Size: 979 Bytes

Versions: 81

Compression:

Stored size: 979 Bytes

Contents

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

require 'test_helper'
require_relative 'common'
require 'hexapdf/font/true_type/table/hhea'
require 'hexapdf/font/true_type/table/hmtx'

describe HexaPDF::Font::TrueType::Table::Hmtx do
  before do
    data = [1, -2, 3, -4, 5, -6].pack('ns>ns>s>2')
    set_up_stub_true_type_font(data)
    hhea = Object.new
    hhea.define_singleton_method(:num_of_long_hor_metrics) { 2 }
    @font.define_singleton_method(:[]) {|_arg| hhea }
  end

  describe "initialize" do
    it "reads the data from the associated file" do
      table = create_table(:Hmtx)
      assert_equal(3, table[2].advance_width)
      assert_equal(5, table[2].left_side_bearing)
      assert_equal(3, table[3].advance_width)
      assert_equal(-6, table[3].left_side_bearing)
      assert_equal(1, table[0].advance_width)
      assert_equal(-2, table[0].left_side_bearing)
      assert_equal(3, table[1].advance_width)
      assert_equal(-4, table[1].left_side_bearing)
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
hexapdf-0.15.5 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.15.4 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.15.3 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.15.2 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.15.1 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.15.0 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.14.4 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.14.3 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.14.2 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.14.1 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.14.0 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.13.0 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.12.3 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.12.2 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.12.1 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.12.0 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.11.9 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.11.8 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.11.7 test/hexapdf/font/true_type/table/test_hmtx.rb
hexapdf-0.11.6 test/hexapdf/font/true_type/table/test_hmtx.rb