Sha256: a64b5023e0b5aeb636fc07ef12d14dcee95a9a15cc1a9df0293d18af5ae7ce13

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

require 'helper'

class TestAfm < Minitest::Test
  
  def setup
    @font = AFM::Font.new(File.join(File.dirname(__FILE__), 'fixtures', 'Vera.afm'))
  end
  
  should "set metadata" do
    assert_equal "BitstreamVeraSans-Roman", @font.metadata['FontName']
    assert_equal "BitstreamVeraSans-Roman", @font['FontName']
  end
  should "set char_metrics" do
    assert_equal 400, @font.char_metrics['exclam'][:wx]
    assert_equal [85, -131, 310, 758], @font.char_metrics['parenleft'][:boundingbox]
  end
  should "set char_metrics_by_code" do
    assert_equal 400, @font.char_metrics_by_code[33][:wx]
    assert_equal [85, -131, 310, 758], @font.char_metrics_by_code[40][:boundingbox]
  end
  
  should "get char metrics by char" do
    assert_equal 400, @font.metrics_for("!")[:wx]
  end
  
  should "open font with alternative method" do
    assert !AFM::Font.from_file(File.join(File.dirname(__FILE__), 'fixtures', 'Vera.afm')).nil?
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
afm-0.2.1 test/test_afm.rb