prawn 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -10
- data/Rakefile +4 -13
- data/data/encodings/win_ansi.txt +29 -0
- data/data/images/fractal.jpg +0 -0
- data/data/images/letterhead.jpg +0 -0
- data/examples/bounding_box/bounding_boxes.rb +44 -0
- data/examples/bounding_box/lazy_bounding_boxes.rb +28 -0
- data/examples/bounding_box/padded_box.rb +24 -0
- data/examples/{russian_boxes.rb → bounding_box/russian_boxes.rb} +9 -6
- data/examples/general/background.rb +20 -0
- data/examples/{canvas.rb → general/canvas.rb} +6 -2
- data/examples/general/measurement_units.rb +52 -0
- data/examples/{multi_page_layout.rb → general/multi_page_layout.rb} +6 -3
- data/examples/{page_geometry.rb → general/page_geometry.rb} +6 -2
- data/examples/{image.rb → graphics/basic_images.rb} +8 -4
- data/examples/graphics/cmyk.rb +13 -0
- data/examples/graphics/curves.rb +12 -0
- data/examples/{hexagon.rb → graphics/hexagon.rb} +5 -5
- data/examples/graphics/image_fit.rb +16 -0
- data/examples/graphics/image_flow.rb +38 -0
- data/examples/graphics/image_position.rb +18 -0
- data/examples/{line.rb → graphics/line.rb} +4 -2
- data/examples/{png_types.rb → graphics/png_types.rb} +4 -4
- data/examples/{polygons.rb → graphics/polygons.rb} +5 -4
- data/examples/graphics/remote_images.rb +12 -0
- data/examples/{ruport_helpers.rb → graphics/ruport_style_helpers.rb} +8 -5
- data/examples/graphics/stroke_bounds.rb +23 -0
- data/examples/{chinese_text_wrapping.rb → m17n/chinese_text_wrapping.rb} +7 -4
- data/examples/m17n/euro.rb +16 -0
- data/examples/m17n/sjis.rb +29 -0
- data/examples/m17n/utf8.rb +14 -0
- data/examples/m17n/win_ansi_charset.rb +55 -0
- data/examples/{addressbook.csv → table/addressbook.csv} +0 -0
- data/examples/{cell.rb → table/cell.rb} +8 -6
- data/examples/{currency.csv → table/currency.csv} +0 -0
- data/examples/{fancy_table.rb → table/fancy_table.rb} +9 -6
- data/examples/{ruport_formatter.rb → table/ruport_formatter.rb} +6 -3
- data/examples/{table.rb → table/table.rb} +6 -2
- data/examples/table/table_alignment.rb +18 -0
- data/examples/table/table_border_color.rb +17 -0
- data/examples/table/table_colspan.rb +19 -0
- data/examples/table/table_header_color.rb +19 -0
- data/examples/table/table_header_underline.rb +15 -0
- data/examples/{alignment.rb → text/alignment.rb} +5 -2
- data/examples/text/family_based_styling.rb +25 -0
- data/examples/{flowing_text_with_header_and_footer.rb → text/flowing_text_with_header_and_footer.rb} +19 -8
- data/examples/text/font_calculations.rb +91 -0
- data/examples/text/font_size.rb +34 -0
- data/examples/{kerning.rb → text/kerning.rb} +5 -1
- data/examples/text/simple_text.rb +18 -0
- data/examples/text/simple_text_ttf.rb +18 -0
- data/examples/{span.rb → text/span.rb} +5 -2
- data/examples/text/text_box.rb +26 -0
- data/examples/{text_flow.rb → text/text_flow.rb} +5 -2
- data/lib/prawn.rb +26 -20
- data/lib/prawn/compatibility.rb +5 -8
- data/lib/prawn/document.rb +29 -13
- data/lib/prawn/document/annotations.rb +63 -0
- data/lib/prawn/document/bounding_box.rb +18 -3
- data/lib/prawn/document/destinations.rb +81 -0
- data/lib/prawn/document/internals.rb +16 -2
- data/lib/prawn/document/page_geometry.rb +58 -57
- data/lib/prawn/document/span.rb +8 -0
- data/lib/prawn/document/table.rb +81 -31
- data/lib/prawn/document/text.rb +66 -21
- data/lib/prawn/document/text/box.rb +77 -0
- data/lib/prawn/encoding.rb +121 -0
- data/lib/prawn/errors.rb +4 -0
- data/lib/prawn/font.rb +70 -42
- data/lib/prawn/font/metrics.rb +64 -119
- data/lib/prawn/graphics.rb +105 -87
- data/lib/prawn/graphics/cell.rb +55 -28
- data/lib/prawn/graphics/color.rb +8 -0
- data/lib/prawn/images.rb +55 -12
- data/lib/prawn/images/jpg.rb +2 -1
- data/lib/prawn/images/png.rb +2 -1
- data/lib/prawn/literal_string.rb +14 -0
- data/lib/prawn/measurement_extensions.rb +46 -0
- data/lib/prawn/measurements.rb +71 -0
- data/lib/prawn/name_tree.rb +165 -0
- data/lib/prawn/pdf_object.rb +8 -1
- data/spec/annotations_spec.rb +90 -0
- data/spec/destinations_spec.rb +15 -0
- data/spec/document_spec.rb +39 -2
- data/spec/font_spec.rb +22 -0
- data/spec/graphics_spec.rb +99 -87
- data/spec/images_spec.rb +29 -1
- data/spec/measurement_units_spec.rb +23 -0
- data/spec/metrics_spec.rb +3 -2
- data/spec/name_tree_spec.rb +103 -0
- data/spec/pdf_object_spec.rb +15 -5
- data/spec/png_spec.rb +14 -14
- data/spec/spec_helper.rb +8 -6
- data/spec/table_spec.rb +40 -0
- data/spec/text_spec.rb +6 -4
- data/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
- data/vendor/ttfunk/example.rb +5 -0
- data/vendor/ttfunk/lib/ttfunk.rb +48 -0
- data/vendor/ttfunk/lib/ttfunk/table.rb +27 -0
- data/vendor/ttfunk/lib/ttfunk/table/cmap.rb +94 -0
- data/vendor/ttfunk/lib/ttfunk/table/directory.rb +25 -0
- data/vendor/ttfunk/lib/ttfunk/table/head.rb +25 -0
- data/vendor/ttfunk/lib/ttfunk/table/hhea.rb +27 -0
- data/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +20 -0
- data/vendor/ttfunk/lib/ttfunk/table/kern.rb +48 -0
- data/vendor/ttfunk/lib/ttfunk/table/maxp.rb +17 -0
- data/vendor/ttfunk/lib/ttfunk/table/name.rb +52 -0
- metadata +93 -62
- data/examples/bounding_boxes.rb +0 -30
- data/examples/curves.rb +0 -10
- data/examples/family_based_styling.rb +0 -21
- data/examples/font_size.rb +0 -19
- data/examples/image2.rb +0 -13
- data/examples/image_flow.rb +0 -29
- data/examples/lazy_bounding_boxes.rb +0 -19
- data/examples/remote_images.rb +0 -7
- data/examples/simple_text.rb +0 -15
- data/examples/simple_text_ttf.rb +0 -16
- data/examples/sjis.rb +0 -21
- data/examples/utf8.rb +0 -12
- data/vendor/font_ttf/ttf.rb +0 -20
- data/vendor/font_ttf/ttf/datatypes.rb +0 -189
- data/vendor/font_ttf/ttf/encodings.rb +0 -140
- data/vendor/font_ttf/ttf/exceptions.rb +0 -28
- data/vendor/font_ttf/ttf/file.rb +0 -290
- data/vendor/font_ttf/ttf/fontchunk.rb +0 -77
- data/vendor/font_ttf/ttf/table/cmap.rb +0 -408
- data/vendor/font_ttf/ttf/table/cvt.rb +0 -49
- data/vendor/font_ttf/ttf/table/fpgm.rb +0 -48
- data/vendor/font_ttf/ttf/table/gasp.rb +0 -88
- data/vendor/font_ttf/ttf/table/glyf.rb +0 -452
- data/vendor/font_ttf/ttf/table/head.rb +0 -86
- data/vendor/font_ttf/ttf/table/hhea.rb +0 -96
- data/vendor/font_ttf/ttf/table/hmtx.rb +0 -98
- data/vendor/font_ttf/ttf/table/kern.rb +0 -186
- data/vendor/font_ttf/ttf/table/loca.rb +0 -75
- data/vendor/font_ttf/ttf/table/maxp.rb +0 -81
- data/vendor/font_ttf/ttf/table/name.rb +0 -222
- data/vendor/font_ttf/ttf/table/os2.rb +0 -172
- data/vendor/font_ttf/ttf/table/post.rb +0 -120
- data/vendor/font_ttf/ttf/table/prep.rb +0 -27
- data/vendor/font_ttf/ttf/table/vhea.rb +0 -45
- data/vendor/font_ttf/ttf/table/vmtx.rb +0 -36
Binary file
|
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class File
|
3
|
+
def initialize(file)
|
4
|
+
@file = file
|
5
|
+
open_file { |fh| @directory = Table::Directory.new(fh) }
|
6
|
+
end
|
7
|
+
|
8
|
+
def open_file
|
9
|
+
::File.open(@file,"rb") do |fh|
|
10
|
+
yield(fh)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.has_tables(*tables)
|
15
|
+
tables.each { |t| has_table(t) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.has_table(t)
|
19
|
+
t = t.to_s
|
20
|
+
|
21
|
+
define_method t do
|
22
|
+
var = "@#{t}"
|
23
|
+
if ivar = instance_variable_get(var)
|
24
|
+
return ivar
|
25
|
+
else
|
26
|
+
klass = Table.const_get(t.capitalize)
|
27
|
+
open_file do |fh|
|
28
|
+
instance_variable_set(var,
|
29
|
+
klass.new(fh, self, directory_info(t)))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def directory_info(table)
|
36
|
+
directory.tables[table.to_s]
|
37
|
+
end
|
38
|
+
|
39
|
+
def method_missing(id,*a,&b)
|
40
|
+
super unless id.to_s["?"]
|
41
|
+
!!directory_info(id.to_s.chop)
|
42
|
+
end
|
43
|
+
|
44
|
+
attr_reader :directory
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
require "ttfunk/table"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "ttfunk/table/directory"
|
2
|
+
|
3
|
+
%w[cmap head hhea hmtx name kern maxp].each do |lib|
|
4
|
+
require "ttfunk/table/" + lib
|
5
|
+
TTFunk::File.has_table lib
|
6
|
+
end
|
7
|
+
|
8
|
+
module TTFunk
|
9
|
+
class Table
|
10
|
+
def method_missing(*args, &block)
|
11
|
+
var = "@#{args.first}"
|
12
|
+
if instance_variables.map { |e| e.to_s }.include?(var)
|
13
|
+
instance_variable_get(var)
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def to_signed(n, length=16)
|
22
|
+
max = 2**length-1
|
23
|
+
mid = 2**(length-1)
|
24
|
+
(n>=mid) ? -((n ^ max) + 1) : n
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Cmap < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
@file = fh
|
6
|
+
@file.pos = info[:offset]
|
7
|
+
|
8
|
+
@version, @table_count = @file.read(4).unpack("n2")
|
9
|
+
|
10
|
+
process_subtables(info[:offset])
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def process_subtables(table_start)
|
16
|
+
@sub_tables = {}
|
17
|
+
@formats = {}
|
18
|
+
@table_count.times do
|
19
|
+
platform_id, encoding_id, offset = @file.read(8).unpack("n2N")
|
20
|
+
@sub_tables[[platform_id, encoding_id]] = offset
|
21
|
+
end
|
22
|
+
|
23
|
+
@sub_tables.each do |ident, offset|
|
24
|
+
@file.pos = table_start + offset
|
25
|
+
format = @file.read(2).unpack("n").first
|
26
|
+
case format
|
27
|
+
when 0
|
28
|
+
read_format0
|
29
|
+
when 4
|
30
|
+
read_format4(table_start)
|
31
|
+
else
|
32
|
+
if $DEBUG
|
33
|
+
warn "TTFunk: Format #{format} not implemented, skipping"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def read_segment
|
40
|
+
@file.read(@segcount_x2).unpack("n#{@segcount_x2 / 2}")
|
41
|
+
end
|
42
|
+
|
43
|
+
def read_format0
|
44
|
+
@file.read(4) # skip length, language for now
|
45
|
+
glyph_ids = @file.read(256).unpack("C256")
|
46
|
+
@formats[0] = glyph_ids
|
47
|
+
end
|
48
|
+
|
49
|
+
def read_format4(table_start)
|
50
|
+
@formats[4] = {}
|
51
|
+
|
52
|
+
length, language = @file.read(4).unpack("n2")
|
53
|
+
@segcount_x2, search_range, entry_selector, range_shift =
|
54
|
+
@file.read(8).unpack("n4")
|
55
|
+
|
56
|
+
extract_format4_glyph_ids(table_start)
|
57
|
+
end
|
58
|
+
|
59
|
+
def extract_format4_glyph_ids(table_start)
|
60
|
+
end_count = read_segment
|
61
|
+
|
62
|
+
@file.read(2) # skip reserved value
|
63
|
+
|
64
|
+
start_count = read_segment
|
65
|
+
id_delta = read_segment.map { |e| to_signed(e) }
|
66
|
+
id_range_offset = read_segment
|
67
|
+
|
68
|
+
remaining_shorts = (@file.pos - table_start) / 2
|
69
|
+
glyph_ids = @file.read(remaining_shorts*2).unpack("n#{remaining_shorts}")
|
70
|
+
|
71
|
+
start_count.each_with_index do |start, i|
|
72
|
+
end_i = end_count[i]
|
73
|
+
delta = id_delta[i]
|
74
|
+
range = id_range_offset[i]
|
75
|
+
|
76
|
+
start.upto(end_i) do |char|
|
77
|
+
if range.zero?
|
78
|
+
gid = char + delta
|
79
|
+
else
|
80
|
+
gindex = range / 2 + (char - start_count[i]) -
|
81
|
+
(segcount_x2 / 2 - i)
|
82
|
+
gid = glyph_ids[gindex] || 0
|
83
|
+
gid += id_delta[i] if gid != 0
|
84
|
+
end
|
85
|
+
gid %= 65536
|
86
|
+
|
87
|
+
@formats[4][char] = gid
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Directory < Table
|
4
|
+
def initialize(fh)
|
5
|
+
@scaler_type, @table_count, @search_range,
|
6
|
+
@entry_selector, @range_shift = fh.read(12).unpack("Nnnnn")
|
7
|
+
parse_table_list(fh)
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse_table_list(fh)
|
11
|
+
first_table = parse_table(fh)
|
12
|
+
@tables = first_table
|
13
|
+
offset = first_table[first_table.keys.first][:offset]
|
14
|
+
|
15
|
+
@tables.update(parse_table(fh)) while fh.pos < offset
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse_table(fh)
|
19
|
+
tag, checksum, offset, length = fh.read(16).unpack("a4NNN")
|
20
|
+
{ tag => {
|
21
|
+
:checksum => checksum, :offset => offset, :length => length } }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Head < TTFunk::Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
data = fh.read(20)
|
7
|
+
@version, @font_revision, @check_sum_adjustment, @magic_number,
|
8
|
+
@flags, @units_per_em = data.unpack("N4n2")
|
9
|
+
|
10
|
+
# skip dates
|
11
|
+
fh.read(16)
|
12
|
+
|
13
|
+
data = fh.read(8)
|
14
|
+
@x_min, @y_min, @x_max, @y_max = data.unpack("n4").map { |e| to_signed(e) }
|
15
|
+
|
16
|
+
data = fh.read(4)
|
17
|
+
@mac_style, @lowest_rec_ppem = data.unpack("n2")
|
18
|
+
|
19
|
+
data = fh.read(6)
|
20
|
+
@font_direction_hint, @index_to_loc_format, @glyph_data_format =
|
21
|
+
data.unpack("n3")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Hhea < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
@length = info[:length]
|
7
|
+
data = fh.read(4)
|
8
|
+
@version = data.unpack("N")
|
9
|
+
|
10
|
+
data = fh.read(6)
|
11
|
+
@ascent, @descent, @line_gap= data.unpack("n3").map {|e| to_signed(e) }
|
12
|
+
|
13
|
+
data = fh.read(2)
|
14
|
+
@advance_width_max = data.unpack("n")
|
15
|
+
|
16
|
+
data = fh.read(22)
|
17
|
+
@min_left_side_bearing, @min_right_side_bearing, @x_max_extent,
|
18
|
+
@caret_slope_rise, @caret_slope_run,
|
19
|
+
@caret_offset, _, _, _, _, @metric_data_format =
|
20
|
+
data.unpack("n11").map {|e| to_signed(e) }
|
21
|
+
|
22
|
+
data = fh.read(2)
|
23
|
+
@number_of_hmetrics = data.unpack("n").first
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Hmtx < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
@values = []
|
7
|
+
|
8
|
+
font.hhea.number_of_hmetrics.times do
|
9
|
+
advance = fh.read(2).unpack("n").first
|
10
|
+
lsb = to_signed(fh.read(2).unpack("n").first)
|
11
|
+
@values << [advance,lsb]
|
12
|
+
end
|
13
|
+
|
14
|
+
lsb_count = font.hhea.number_of_hmetrics - font.maxp.num_glyphs
|
15
|
+
pattern = "n#{lsb_count}"
|
16
|
+
@lsb = fh.read(2*lsb_count).unpack(pattern).map { |e| to_signed(e) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Kern < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
data = fh.read(4)
|
7
|
+
@fh = fh
|
8
|
+
@version, @table_count = data.unpack("n2")
|
9
|
+
|
10
|
+
@table_headers = {}
|
11
|
+
|
12
|
+
@table_count.times do
|
13
|
+
version, length, coverage = fh.read(6).unpack("n3")
|
14
|
+
@table_headers[version] = { :length => length,
|
15
|
+
:coverage => coverage,
|
16
|
+
:format => coverage >> 8 }
|
17
|
+
end
|
18
|
+
|
19
|
+
generate_subtables
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_subtables
|
23
|
+
@sub_tables = {}
|
24
|
+
@table_headers.each do |version, data|
|
25
|
+
if data[:format].zero?
|
26
|
+
@sub_tables[0] = parse_subtable_format0
|
27
|
+
else
|
28
|
+
warn "TTFunk does not support kerning tables of format #{data[:format]}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def parse_subtable_format0
|
34
|
+
sub_table = {}
|
35
|
+
pair_count, search_range, entry_selector, range_shift = @fh.read(8).unpack("n4")
|
36
|
+
|
37
|
+
pair_count.times do
|
38
|
+
left, right = @fh.read(4).unpack("n2")
|
39
|
+
fword = to_signed(@fh.read(2).unpack("n").first)
|
40
|
+
sub_table[[left,right]] = fword
|
41
|
+
end
|
42
|
+
|
43
|
+
return sub_table
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Maxp < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
@length = info[:length]
|
7
|
+
data = fh.read(@length)
|
8
|
+
@version, @num_glyphs, @max_points, @max_contours,
|
9
|
+
@max_component_points,@max_component_contours, @max_zones,
|
10
|
+
@max_twilight_points, @max_storage, @max_function_defs,
|
11
|
+
@max_instruction_defs,@max_stack_elements,
|
12
|
+
@max_size_of_instructions, @max_component_elements,
|
13
|
+
@max_component_depth = data.unpack("Nn14")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module TTFunk
|
2
|
+
class Table
|
3
|
+
class Name < Table
|
4
|
+
def initialize(fh, font, info)
|
5
|
+
fh.pos = info[:offset]
|
6
|
+
data = fh.read(6)
|
7
|
+
@table_start = info[:offset]
|
8
|
+
@format, @record_count, @string_offset = data.unpack("nnn")
|
9
|
+
parse_name_records(fh)
|
10
|
+
parse_strings(fh)
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse_name_records(fh)
|
14
|
+
@records = {}
|
15
|
+
@record_count.times { @records.update(parse_name_record(fh)) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse_name_record(fh)
|
19
|
+
data = fh.read(12).unpack("n6")
|
20
|
+
platform, encoding, language, id, length, offset = data
|
21
|
+
{ id => {
|
22
|
+
:platform => platform, :encoding => encoding,
|
23
|
+
:language => language, :length => length,
|
24
|
+
:offset => offset } }
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_strings(fh)
|
28
|
+
@strings = @records.inject({}) do |s,v|
|
29
|
+
id, options = v
|
30
|
+
|
31
|
+
fh.pos = @table_start + @string_offset + options[:offset]
|
32
|
+
s.merge(id => fh.read(options[:length]).delete("\000"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def name_data
|
37
|
+
[:copyright, :font_family, :font_subfamily, :unique_subfamily_id,
|
38
|
+
:full_name, :name_table_version, :postscript_name, :trademark_notice,
|
39
|
+
:manufacturer_name, :designer, :description, :vendor_url,
|
40
|
+
:designer_url, :license_description, :license_info_url ]
|
41
|
+
end
|
42
|
+
|
43
|
+
def method_missing(*args,&block)
|
44
|
+
if name_data.include?(args.first)
|
45
|
+
@strings[name_data.index(args.first)]
|
46
|
+
else
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-16 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,50 +24,76 @@ extra_rdoc_files:
|
|
24
24
|
- LICENSE
|
25
25
|
- COPYING
|
26
26
|
files:
|
27
|
-
- examples/
|
28
|
-
- examples/
|
29
|
-
- examples/
|
30
|
-
- examples/
|
31
|
-
- examples/
|
32
|
-
- examples/
|
33
|
-
- examples/
|
34
|
-
- examples/
|
35
|
-
- examples/
|
36
|
-
- examples/
|
37
|
-
- examples/
|
38
|
-
- examples/
|
39
|
-
- examples/
|
40
|
-
- examples/
|
41
|
-
- examples/
|
42
|
-
- examples/
|
43
|
-
- examples/
|
44
|
-
- examples/
|
45
|
-
- examples/
|
46
|
-
- examples/
|
47
|
-
- examples/
|
48
|
-
- examples/
|
49
|
-
- examples/
|
50
|
-
- examples/
|
51
|
-
- examples/
|
52
|
-
- examples/
|
53
|
-
- examples/
|
54
|
-
- examples/
|
55
|
-
- examples/
|
56
|
-
- examples/
|
57
|
-
- examples/
|
58
|
-
- examples/table
|
59
|
-
- examples/
|
60
|
-
- examples/
|
27
|
+
- examples/bounding_box
|
28
|
+
- examples/bounding_box/bounding_boxes.rb
|
29
|
+
- examples/bounding_box/lazy_bounding_boxes.rb
|
30
|
+
- examples/bounding_box/padded_box.rb
|
31
|
+
- examples/bounding_box/russian_boxes.rb
|
32
|
+
- examples/general
|
33
|
+
- examples/general/background.rb
|
34
|
+
- examples/general/canvas.rb
|
35
|
+
- examples/general/measurement_units.rb
|
36
|
+
- examples/general/multi_page_layout.rb
|
37
|
+
- examples/general/page_geometry.rb
|
38
|
+
- examples/graphics
|
39
|
+
- examples/graphics/basic_images.rb
|
40
|
+
- examples/graphics/cmyk.rb
|
41
|
+
- examples/graphics/curves.rb
|
42
|
+
- examples/graphics/hexagon.rb
|
43
|
+
- examples/graphics/image_fit.rb
|
44
|
+
- examples/graphics/image_flow.rb
|
45
|
+
- examples/graphics/image_position.rb
|
46
|
+
- examples/graphics/line.rb
|
47
|
+
- examples/graphics/png_types.rb
|
48
|
+
- examples/graphics/polygons.rb
|
49
|
+
- examples/graphics/remote_images.rb
|
50
|
+
- examples/graphics/ruport_style_helpers.rb
|
51
|
+
- examples/graphics/stroke_bounds.rb
|
52
|
+
- examples/m17n
|
53
|
+
- examples/m17n/chinese_text_wrapping.rb
|
54
|
+
- examples/m17n/euro.rb
|
55
|
+
- examples/m17n/sjis.rb
|
56
|
+
- examples/m17n/utf8.rb
|
57
|
+
- examples/m17n/win_ansi_charset.rb
|
58
|
+
- examples/table
|
59
|
+
- examples/table/addressbook.csv
|
60
|
+
- examples/table/cell.rb
|
61
|
+
- examples/table/currency.csv
|
62
|
+
- examples/table/fancy_table.rb
|
63
|
+
- examples/table/ruport_formatter.rb
|
64
|
+
- examples/table/table.rb
|
65
|
+
- examples/table/table_alignment.rb
|
66
|
+
- examples/table/table_border_color.rb
|
67
|
+
- examples/table/table_colspan.rb
|
68
|
+
- examples/table/table_header_color.rb
|
69
|
+
- examples/table/table_header_underline.rb
|
70
|
+
- examples/text
|
71
|
+
- examples/text/alignment.rb
|
72
|
+
- examples/text/family_based_styling.rb
|
73
|
+
- examples/text/flowing_text_with_header_and_footer.rb
|
74
|
+
- examples/text/font_calculations.rb
|
75
|
+
- examples/text/font_size.rb
|
76
|
+
- examples/text/kerning.rb
|
77
|
+
- examples/text/simple_text.rb
|
78
|
+
- examples/text/simple_text_ttf.rb
|
79
|
+
- examples/text/span.rb
|
80
|
+
- examples/text/text_box.rb
|
81
|
+
- examples/text/text_flow.rb
|
61
82
|
- lib/prawn
|
62
83
|
- lib/prawn/compatibility.rb
|
63
84
|
- lib/prawn/document
|
85
|
+
- lib/prawn/document/annotations.rb
|
64
86
|
- lib/prawn/document/bounding_box.rb
|
87
|
+
- lib/prawn/document/destinations.rb
|
65
88
|
- lib/prawn/document/internals.rb
|
66
89
|
- lib/prawn/document/page_geometry.rb
|
67
90
|
- lib/prawn/document/span.rb
|
68
91
|
- lib/prawn/document/table.rb
|
92
|
+
- lib/prawn/document/text
|
93
|
+
- lib/prawn/document/text/box.rb
|
69
94
|
- lib/prawn/document/text.rb
|
70
95
|
- lib/prawn/document.rb
|
96
|
+
- lib/prawn/encoding.rb
|
71
97
|
- lib/prawn/errors.rb
|
72
98
|
- lib/prawn/font
|
73
99
|
- lib/prawn/font/cmap.rb
|
@@ -82,48 +108,30 @@ files:
|
|
82
108
|
- lib/prawn/images/jpg.rb
|
83
109
|
- lib/prawn/images/png.rb
|
84
110
|
- lib/prawn/images.rb
|
111
|
+
- lib/prawn/literal_string.rb
|
112
|
+
- lib/prawn/measurement_extensions.rb
|
113
|
+
- lib/prawn/measurements.rb
|
114
|
+
- lib/prawn/name_tree.rb
|
85
115
|
- lib/prawn/pdf_object.rb
|
86
116
|
- lib/prawn/reference.rb
|
87
117
|
- lib/prawn.rb
|
118
|
+
- spec/annotations_spec.rb
|
88
119
|
- spec/bounding_box_spec.rb
|
120
|
+
- spec/destinations_spec.rb
|
89
121
|
- spec/document_spec.rb
|
90
122
|
- spec/font_spec.rb
|
91
123
|
- spec/graphics_spec.rb
|
92
124
|
- spec/images_spec.rb
|
93
125
|
- spec/jpg_spec.rb
|
126
|
+
- spec/measurement_units_spec.rb
|
94
127
|
- spec/metrics_spec.rb
|
128
|
+
- spec/name_tree_spec.rb
|
95
129
|
- spec/pdf_object_spec.rb
|
96
130
|
- spec/png_spec.rb
|
97
131
|
- spec/reference_spec.rb
|
98
132
|
- spec/spec_helper.rb
|
99
133
|
- spec/table_spec.rb
|
100
134
|
- spec/text_spec.rb
|
101
|
-
- vendor/font_ttf
|
102
|
-
- vendor/font_ttf/ttf
|
103
|
-
- vendor/font_ttf/ttf/datatypes.rb
|
104
|
-
- vendor/font_ttf/ttf/encodings.rb
|
105
|
-
- vendor/font_ttf/ttf/exceptions.rb
|
106
|
-
- vendor/font_ttf/ttf/file.rb
|
107
|
-
- vendor/font_ttf/ttf/fontchunk.rb
|
108
|
-
- vendor/font_ttf/ttf/table
|
109
|
-
- vendor/font_ttf/ttf/table/cmap.rb
|
110
|
-
- vendor/font_ttf/ttf/table/cvt.rb
|
111
|
-
- vendor/font_ttf/ttf/table/fpgm.rb
|
112
|
-
- vendor/font_ttf/ttf/table/gasp.rb
|
113
|
-
- vendor/font_ttf/ttf/table/glyf.rb
|
114
|
-
- vendor/font_ttf/ttf/table/head.rb
|
115
|
-
- vendor/font_ttf/ttf/table/hhea.rb
|
116
|
-
- vendor/font_ttf/ttf/table/hmtx.rb
|
117
|
-
- vendor/font_ttf/ttf/table/kern.rb
|
118
|
-
- vendor/font_ttf/ttf/table/loca.rb
|
119
|
-
- vendor/font_ttf/ttf/table/maxp.rb
|
120
|
-
- vendor/font_ttf/ttf/table/name.rb
|
121
|
-
- vendor/font_ttf/ttf/table/os2.rb
|
122
|
-
- vendor/font_ttf/ttf/table/post.rb
|
123
|
-
- vendor/font_ttf/ttf/table/prep.rb
|
124
|
-
- vendor/font_ttf/ttf/table/vhea.rb
|
125
|
-
- vendor/font_ttf/ttf/table/vmtx.rb
|
126
|
-
- vendor/font_ttf/ttf.rb
|
127
135
|
- vendor/pdf-inspector
|
128
136
|
- vendor/pdf-inspector/lib
|
129
137
|
- vendor/pdf-inspector/lib/pdf
|
@@ -134,6 +142,27 @@ files:
|
|
134
142
|
- vendor/pdf-inspector/lib/pdf/inspector/xobject.rb
|
135
143
|
- vendor/pdf-inspector/lib/pdf/inspector.rb
|
136
144
|
- vendor/pdf-inspector/README
|
145
|
+
- vendor/ttfunk
|
146
|
+
- vendor/ttfunk/data
|
147
|
+
- vendor/ttfunk/data/fonts
|
148
|
+
- vendor/ttfunk/data/fonts/comicsans.ttf
|
149
|
+
- vendor/ttfunk/data/fonts/DejaVuSans.ttf
|
150
|
+
- vendor/ttfunk/example.rb
|
151
|
+
- vendor/ttfunk/lib
|
152
|
+
- vendor/ttfunk/lib/ttfunk
|
153
|
+
- vendor/ttfunk/lib/ttfunk/table
|
154
|
+
- vendor/ttfunk/lib/ttfunk/table/cmap.rb
|
155
|
+
- vendor/ttfunk/lib/ttfunk/table/directory.rb
|
156
|
+
- vendor/ttfunk/lib/ttfunk/table/head.rb
|
157
|
+
- vendor/ttfunk/lib/ttfunk/table/hhea.rb
|
158
|
+
- vendor/ttfunk/lib/ttfunk/table/hmtx.rb
|
159
|
+
- vendor/ttfunk/lib/ttfunk/table/kern.rb
|
160
|
+
- vendor/ttfunk/lib/ttfunk/table/maxp.rb
|
161
|
+
- vendor/ttfunk/lib/ttfunk/table/name.rb
|
162
|
+
- vendor/ttfunk/lib/ttfunk/table.rb
|
163
|
+
- vendor/ttfunk/lib/ttfunk.rb
|
164
|
+
- data/encodings
|
165
|
+
- data/encodings/win_ansi.txt
|
137
166
|
- data/fonts
|
138
167
|
- data/fonts/Activa.ttf
|
139
168
|
- data/fonts/Chalkboard.ttf
|
@@ -163,6 +192,8 @@ files:
|
|
163
192
|
- data/images/dice.alpha
|
164
193
|
- data/images/dice.dat
|
165
194
|
- data/images/dice.png
|
195
|
+
- data/images/fractal.jpg
|
196
|
+
- data/images/letterhead.jpg
|
166
197
|
- data/images/page_white_text.alpha
|
167
198
|
- data/images/page_white_text.dat
|
168
199
|
- data/images/page_white_text.png
|