Sha256: 8bcca1b3a1bef9dadeaa567b16eef2177cd54d82399741d60487e358a1dee760

Contents?: true

Size: 1.12 KB

Versions: 41

Compression:

Stored size: 1.12 KB

Contents

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

require 'test_helper'
require 'hexapdf/document'
require 'hexapdf/type/font_true_type'

describe HexaPDF::Type::FontTrueType do
  before do
    @doc = HexaPDF::Document.new
    font_descriptor = @doc.add({Type: :FontDescriptor, FontName: :Something, Flags: 0b100,
                                FontBBox: [0, 1, 2, 3], ItalicAngle: 0, Ascent: 900,
                                Descent: -100, CapHeight: 800, StemV: 20})
    @font = @doc.add({Type: :Font, Subtype: :TrueType, Encoding: :WinAnsiEncoding,
                      FirstChar: 32, LastChar: 34, Widths: [600, 0, 700],
                      BaseFont: :Something, FontDescriptor: font_descriptor})
  end

  describe "validation" do
    it "ignores some missing fields if the font name is one of the standard PDF fonts" do
      @font[:BaseFont] = :'Arial,Bold'
      [:FirstChar, :LastChar, :Widths, :FontDescriptor].each {|field| @font.delete(field) }
      assert(@font.validate)
    end

    it "requires that the FontDescriptor key is set" do
      assert(@font.validate)
      @font.delete(:FontDescriptor)
      refute(@font.validate)
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
hexapdf-0.27.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.26.2 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.26.1 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.26.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.25.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.24.2 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.24.1 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.24.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.23.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.22.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.21.1 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.21.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.20.4 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.20.3 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.20.2 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.20.1 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.20.0 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.19.3 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.19.2 test/hexapdf/type/test_font_true_type.rb
hexapdf-0.19.1 test/hexapdf/type/test_font_true_type.rb