File: font_descriptor_spec.rb

package info (click to toggle)
ruby-pdf-reader 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 12,908 kB
  • ctags: 569
  • sloc: ruby: 8,330; makefile: 10
file content (56 lines) | stat: -rw-r--r-- 1,658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# coding: utf-8

require "spec_helper"

describe PDF::Reader::FontDescriptor, "initialisation" do
  let!(:dict) do
    {
      :Ascent       => 10,
      :Descent      => 10,
      :MissingWidth => 500,
      :FontBBox     => [0, 0, 10, 10],
      :AvgWidth     => 40,
      :CapHeight    => 30,
      :Flags        => 1,
      :ItalicAngle  => 0,
      :FontName     => :Helvetica,
      :Leading      => 0,
      :MaxWidth     => 500,
      :StemV        => 0,
      :XHeight      => 0,
      :FontStretch  => :Condensed,
      :FontWeight   => 500,
      :FontFamily   => :BoldItalic
    }
  end
  let!(:objects) { PDF::Reader::ObjectHash.allocate }
  subject        { PDF::Reader::FontDescriptor.new(objects, dict)}

  it "should set the correct instance vars" do
    subject.ascent.should            == 10
    subject.descent.should           == 10
    subject.missing_width.should     == 500
    subject.font_bounding_box.should == [0,0, 10, 10]
    subject.avg_width.should         == 40
    subject.cap_height.should        == 30
    subject.font_flags.should        == 1
    subject.italic_angle.should      == 0
    subject.font_name.should         == "Helvetica"
    subject.leading.should           == 0
    subject.max_width.should         == 500
    subject.stem_v.should            == 0
    subject.x_height.should          == 0
    subject.font_stretch.should      == :Condensed
    subject.font_weight.should       == 500
    subject.font_family.should       == :BoldItalic
  end

end

describe PDF::Reader::FontDescriptor, "#glyph_width" do
  pending
end

describe PDF::Reader::FontDescriptor, "#glyph_to_pdf_scale_factor" do
  pending
end